Skip to content
Prev 180212 / 398502 Next

access to the current element of lapply

On May 13, 2009, at 9:12 AM, Martial Sankar wrote:

            
# Split on BOTH columns and drop unused levels
L <- split(df, list(df$X1, df$X2), drop = TRUE)

 > L
$A.1
   X1 X2
1  A  1

$A.2
   X1 X2
2  A  2

$B.3
   X1 X2
3  B  3

$B.4
   X1 X2
4  B  4


Is that what you want?

HTH,

Marc Schwartz