[R] How to calculate?
Erik Iverson
iverson at biostat.wisc.edu
Sat Nov 15 16:56:02 CET 2008
see ?tapply, for example:
tapply(df$x, df$z, mean)
Might also look at ?ave and ?aggregate depending on what form you want
the result to have... or the "plyr" package on CRAN. Lots of options!
stat4u wrote:
> hi,
> How can i calculate means with catergory of variable...
>
> like
>
> x y z
> 2 3 y
> 3 4 n
> 1 2 y
> 6 3 n
> 9 1 y
> 2 2 n
> 8 3 y
>
> i want to get mean of x and y with respective to its category(y,n)
>
> thanks...
> regards,
> Muhammad Faisal
More information about the R-help
mailing list