1 convert = function(orig_csv_file, nb_series_per_chunk)
3 orig_file = file(orig_csv_file, open="r")
4 ignored = readLines(orig_file, 1) #skip header
6 serie_length = 17520 #365*24*2
7 library(sqldf, quietly=TRUE)
8 ids = read.csv.sql(file_csv, header = TRUE, sep = ","
9 sql = "select * from file_csv group by FK_CCU_ID")
13 if (index+1 >= length(ids))
15 request = "select CPP_DATE_PUISSANCE,CPP_PUISSANCE_BRUTE where FK_CCU_ID in ("
16 for (id in ids[index + seq_len(nb_series_per_chunk)])
17 request = paste(request, id, ",", sep="")
18 request = paste(request, ") order by FK_CCU_ID,CPP_DATE_PUISSANCE", sep="")
19 series_chunk = read.csv.sql(file_csv, header = TRUE, sep = ",", sql = request)