[R] subsets in data frame

Spencer Graves spencer.graves at pdf.com
Wed Jul 14 05:28:20 CEST 2004


?tapply

The examples there seem to describe what you want.  hope this helps.  
spencer graves

Laura Holt wrote:

> Hello R People:
>
> I have a data frame with 2 numeric variables and 1 factor.
>
> There are 3 levels of the factor.
>
> I would like to get sums/means/etc of the numeric variables with 
> respect to the factor level.
>
> I tried "table" and "subset" but have not hit upon a solution.
>
> I thought maybe "apply" would be the answer but can't figure out how 
> to break out by factor.
>
> Any suggestions would be most appreciated.
>
> Thanks yet again.
> R Version 1.9.1 for windows
> Sincerely,
> Laura Holt
> mailto: lauraholt_983 at hotmail.com
>
>
> your life. http://lifeevents.msn.com
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list