Re: [R] List of sublists

2008-10-01 Thread Lauri Nikkinen
Yes, Thanks! -Lauri 2008/10/1 Dimitris Rizopoulos <[EMAIL PROTECTED]> > one way is the following: > > df <- data.frame(month = as.character(rep(1:3, each = 30)), fac = > factor(rep(1:2, each = 15)), data1 = round(runif(90), 2), data2 = > round(runif(90), 2)) > > lapply(split(df, df$month), funct

Re: [R] List of sublists

2008-10-01 Thread Richard . Cotton
> I would like to split this df by month and fac and produce list of sublists > > df <- data.frame(month=as.character(rep(1:3,each=30)), > fac=factor(rep(1:2,each=15)), > data1=round(runif(90),2), > data2=round(runif(90),2)) > > This > > split(df, paste(df$month, df$fac)

Re: [R] List of sublists

2008-10-01 Thread Dimitris Rizopoulos
one way is the following: df <- data.frame(month = as.character(rep(1:3, each = 30)), fac = factor(rep(1:2, each = 15)), data1 = round(runif(90), 2), data2 = round(runif(90), 2)) lapply(split(df, df$month), function(x) split(x, x$fac)) I hope it helps. Best, Dimitris Lauri Nikkinen wrote

[R] List of sublists

2008-10-01 Thread Lauri Nikkinen
R users, I would like to split this df by month and fac and produce list of sublists df <- data.frame(month=as.character(rep(1:3,each=30)),fac=factor(rep(1:2,each=15)), data1=round(runif(90),2), data2=round(runif(90),2)) This split(df, paste(df$month, df$fac)) produces