'update'
[epclust.git] / data / preprocessing / convert_32kEDF.R
similarity index 58%
rename from data/preprocessing/convert_ts.R
rename to data/preprocessing/convert_32kEDF.R
index 6c48b07..2e6798a 100644 (file)
@@ -1,9 +1,12 @@
-convert = function(orig_csv_file, nb_series_per_chunk)
+convert_32kEDF = function(orig_csv, nb_series_per_chunk)
 {
-       orig_file = file(orig_csv_file, open="r")
-       ignored = readLines(orig_file, 1) #skip header
+       datetimes = #...TODO: all 3 years? year-by-year is better
+       orig_con = file(orig_csv, open="r") #2009, 2010 or 2011
+       ignored = readLines(orig_con, 1) #skip header
+       serie_length = length(datetimes) #around 365*24*2 = 17520
+       sep = if (year==2009) "," else if (year==2010) ";" else ";"
 
-       serie_length = 17520 #365*24*2
+scan(orig_con, character(), sep=",", nlines=1, quiet=TRUE)
        library(sqldf, quietly=TRUE)
        ids = read.csv.sql(file_csv, header = TRUE, sep = ","
                sql = "select * from file_csv group by FK_CCU_ID")