Neil Osborne
2003-May-18 22:11 UTC
[R] How to split a dataframe into smaller constituent dataframes
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
Dirk Eddelbuettel
2003-May-18 22:27 UTC
[R] How to split a dataframe into smaller constituent dataframes
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.
Possibly Parallel Threads
- Converting dates?
- Split dataframe into new dataframes
- fill a dataframe with zeros where the rows are a smaller subset of a larger dataframe (species by site)
- creating a "list of 3 dataframes" from a "list of 2 dataframes" and a dataframe?
- dataframe of dataframes?