Skip to content
Back to formatted view

Raw Message

Message-ID: <C83C5E3DEEE97E498B74729A33F6EAEC056300BB@DJFPOST01.djf.agrsci.dk>
Date: 2009-01-11T23:15:17Z
From: Søren Højsgaard
Subject: summary with variance / sd

You can use summaryBy() in the doBy package:
 
summaryBy(y+x~group, data=mydata, FUN=c(mean,sd))
 
S?ren

________________________________

Fra: r-help-bounces at r-project.org p? vegne af J?rg Gro?
Sendt: s? 11-01-2009 22:38
Til: r-help at r-project.org
Emne: [R] summary with variance / sd



Hi,

I have a data frame and would like to have summary statistics for 
grouped data.

With summary() I get the central tendencies for the overall data.


How can I get descriptive statistics with variances and standard 
deviations?


for example my data.frame:

group   x       y
exp             2       4
exp             3       5
exp             2       4
control 1       2
control 2       3
control 1       2


now I want tables with summary statistics (variances included) for 
each group.

Is there an easy way to get this?

______________________________________________
R-help at 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.