[R] Create a new dataframe from an existing dataframe

Gang Chen gangchen at mail.nih.gov
Mon Jan 7 19:28:26 CET 2008


I have a dataframe DF with 4 columns (variables) A, B, C, and D, and  
want to create a new dataframe DF2 by keeping B and C in DF but  
counting the frequency of D while collapsing A. I tried

by(DF$D, list(DF$B, DF$C), FUN=summary)

but this is not exactly what I want. What is a good way to do it?

Thanks,
Gang




More information about the R-help mailing list