I have read a large dataset into a dataframe using RODBC, the rows of data in the dataframe are (integer) timestamped and I would like to divide the original dataframe into n smaller dataframes where dataframe 1 contains all rows that had timestamps falling in the period 0-x1 minutes, dataframe 2 contains all rows that had timestamps falling between x1+1 and x2, etc.. Does anyone know how to do this? Thanks _________________________________________________________________ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059
How to split a dataframe into smaller constituent dataframes
2 messages · Neil Osborne, Dirk Eddelbuettel
On Sun, May 18, 2003 at 10:11:11PM +0000, Neil Osborne wrote:
I have read a large dataset into a dataframe using RODBC, the rows of data in the dataframe are (integer) timestamped and I would like to divide the original dataframe into n smaller dataframes where dataframe 1 contains all rows that had timestamps falling in the period 0-x1 minutes, dataframe 2 contains all rows that had timestamps falling between x1+1 and x2, etc.. Does anyone know how to do this?
I would convert all your dates to DateTimeClass (i.e. POSIXct or POSIXlt), e.g. using strptime, and then loop over them doing your subsetting at each grid step you specify. R really has excellent facilities to compute on, or compare, dates up to Unix timestamp precision. Alternatively, if the data lives in a DBMS you could simply tailor your queries to the desired grid sizes and retrieve individual chunks and store those. Hth, Dirk
Don't drink and derive. Alcohol and analysis don't mix.