[R] how to split a data framed with sequences

David Carslaw d.c.carslaw at its.leeds.ac.uk
Tue Sep 9 11:38:30 CEST 2008


Hi all,

Given a data frame:

my.df <- data.frame(a = c(1:5, 1:10, 1:20), b = runif(35))

I want to split it by "a" such that I end up with a list containing 3
components i.e. the first containing a = 1 to 5, the second a = 1 to 10 etc.
In other words, sets of sequences of a.

I can't seem to find the right form using the split function - can you help? 

Much appreciated.

David



-----
Institute for Transport Studies
University of Leeds
-- 
View this message in context: http://www.nabble.com/how-to-split-a-data-framed-with-sequences-tp19388964p19388964.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list