[R] Running an ANOVA with a BY
baxterj
jdew at vt.edu
Mon Sep 28 20:15:25 CEST 2009
I downloaded the package and got it to work with the coding:
model <- function(df) {aov(values ~ WellID, data = twelldata)}
ANOVA1way <- dlply(twelldata, .(Analyte), model)
print(ANOVA1way)
This gives me degrees of freedom and sum of squares for each anova per
analyte. However, I cant get the summary(ANOVA1way) to work so that I can
get p-values, etc... How can I do this?
Jodi
Tobias Verbeke-2 wrote:
>
> baxterj wrote:
>> I have a simple 1 way anova coded like
>>
>> summary(ANOVA1way <- aov(Value ~ WellID, data = welldata))
>>
>> How can I use the BY function to do this ANOVA for each group using
>> another
>> variable in the dataset?? I tried coding it like this, but it doesn't
>> seem
>> to work.
>>
>> summary(ANOVA1way <- by(welldata, Analyte, function(x) aov(Value ~
>> WellID,
>> data = welldata)))
>>
>> In SAS I would code it like this:
>> Proc sort data=welldata; by analyte; run;
>> Proc glm data=welldata;
>> by analyte;
>> class wellid;
>> model value = wellid;
>> run;
>
> Look at the plyr package for a general solution to
> this type of problems:
>
> http://cran.r-project.org/web/packages/plyr/index.html
>
> and its introductory guide on the package home page:
>
> http://had.co.nz/plyr/
>
> HTH,
> Tobias
>
> ______________________________________________
> 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.
>
>
--
View this message in context: http://www.nabble.com/Running-an-ANOVA-with-a-BY-tp25645413p25650273.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list