On 1/7/2008 1:28 PM, Gang Chen wrote:
> 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?

I think you can't do that.  If you want to keep B and C, then you can't 
reduce the number of rows, but "collapsing A" sounds like you want fewer 
rows.

Perhaps if you posted a simple before and after example?

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to