[R] List of sublists

Lauri Nikkinen lauri.nikkinen at iki.fi
Wed Oct 1 12:48:49 CEST 2008


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 just a single list. Any ideas?

Many thanks,
Lauri



More information about the R-help mailing list