- coeffs_chunk = NULL
- if (is.data.frame(data))
- {
- #full data matrix
- if (index < nrow(data))
- {
- coeffs_chunk = curvesToCoeffs(
- data[index:(min(index+nb_series_per_chunk-1,nrow(data))),], wf)
- }
- } else if (is.function(data))
- {
- #custom user function to retrieve next n curves, probably to read from DB
- coeffs_chunk = curvesToCoeffs( data(index, nb_series_per_chunk), wf )
- } else
- {
- #incremental connection
- #TODO: find a better way to parse than using a temp file
- ascii_lines = readLines(data_con, nb_series_per_chunk)
- if (length(ascii_lines > 0))
- {
- series_chunk_file = ".tmp/series_chunk"
- writeLines(ascii_lines, series_chunk_file)
- coeffs_chunk = curvesToCoeffs( read.csv(series_chunk_file), wf )
- }
- }
- if (is.null(coeffs_chunk))