I am reading a big data file from a database (test1). Millions of rows that I cannot read and processed directly in R.
I would like to create sub-files from this big file based on the column "horodatage". I gave an example below to extract one file from the big file, but now I want to do it for all the file not only between these two dates.
The split must start at this date "23/03/2005 11:00" and go until the end of the big file (approximatively around "31/12/2005 23:59" (test1 from the data base) and the duration of one sub file must be 30min (in other words: exactly 36000 rows per sub files).
Each sub file must then be saved with a name like (A200503231100.dat, A200503231130.dat,A200503231200.dat, A200503231230.dat etc...)
The format of the column horodatage is already
> class(montableau$horodatage)
[1] "POSIXct" "POSIXt"
The code I started with is:
heuredebut = "23/03/2005 11:00"
heurefin = "23/03/2005 11:30"
query = paste("select * from test1 where horodatage >= ",heuredebut," and horodatage < ",heurefin," order by horodatage;",sep="'")
montableau <- dbGetQuery (connection_db,query)
If you have any insights of the loop to do on this big file, it would be very helpful.