Skip to content
Prev 285353 / 398502 Next

Splitting a data list into smaller data lists

Comments below.
On Tue, 14 Feb 2012, lawonga wrote:

            
"Right" direction?

Type
   ?split
and
   ?":"
and
   ?"%/%"
and
   ?nrow
at the R command line

Read the "Introduction to R" (I2R) focusing on vector indexing.  Whenever 
possible you should prefer to use vector indexing instead of a for loop 
(there are certainly reasons to use for loops, but in most cases where 
they might be appropriate there are iterator functions like lapply that 
lead to more succinct and possibly faster code).

To use the resulting list, you will probably want to read
   ?lapply
and/or
   ?"[["

although the discussion of lists in I2R may be more digestible.

Depending on how you want to process data in the bigger picture, you may 
find the plyr package helpful.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                       Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k