Re: [R] access to the current element of lapply

2009-05-13 Thread Marc Schwartz
On May 13, 2009, at 9:12 AM, Martial Sankar wrote: Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : (df <- data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 (L<-split(df, df$X1

[R] access to the current element of lapply

2009-05-13 Thread Martial Sankar
Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : > (df <- data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 > (L<-split(df, df$X1)) $A X1 X2 1 A 1 2 A 2 $B X1 X2 3 B 3 4