[R] Learning ANOVA
Stephen Liu
satimis at yahoo.com
Sat Aug 14 06:03:00 CEST 2010
Hi Chris,
Thanks for your advice which works for me here.
I'm reading;
An Introduction to R
http://h1.mg4.mail.yahoo.com/dc/launch?sysreq=ignore
NOT finish yet. Also I found many tutorials on Internet. I'll take me time
going through all of them.
I'm interesting reading tutorial with demo. Otherwise it won't be easy for a
beginning remembering all commands and steps on manual.
B.R.
Stephen L
----- Original Message ----
From: Christopher W Ryan <cryan at binghamton.edu>
To: R-help at r-project.org
Sent: Sat, August 14, 2010 1:51:34 AM
Subject: Re: [R] Learning ANOVA
Read documentation for TukeyHSD by typing the command:
?TukeyHSD
The input to that function should usually be, "a fitted model object,
usually an aov fit."
You have not created a "fitted model object."
This seems to work:
model <- aov(InsectSprays$count ~ InsectSprays$spray)
TukeyHSD(model)
The aov() makes the aov model object. Tacking .aov onto an object name
doesn't do that.
Which introductory R book(s) have you read? That would be a worthwhile
investment of your time.
--Chris Ryan
On Fri, Aug 13, 2010 at 12:43 PM, Stephen Liu <satimis at yahoo.com> wrote:
> Hi Erik,
>
>
> I followed following video as example;
>
> ANOVA in R
> http://www.youtube.com/watch?v=Dwd3ha0P8uw&feature=related
>
>
> Now I got it done;
>
> > boxplot(test01$count ~ test01$spray)
>
>
> Continued:
>
> > InsectSprays.aov <-(test01$count ~ test01$spray)
> > summary(InsectSprays.aov)
> Length Class Mode
> 3 formula call
>
> Seems having problem here.
>
>
> > TukeyHSD(InsectSprays.aov)
> Error in UseMethod("TukeyHSD") :
> no applicable method for 'TukeyHSD' applied to an object of class
> "formula"
>
> I'm still stuck here.
>
>
> B.R.
> Stephen L
>
>
>
>
> ----- Original Message ----
> From: Erik Iverson <eriki at ccbr.umn.edu>
> To: Stephen Liu <satimis at yahoo.com>
> Cc: r-help at r-project.org
> Sent: Sat, August 14, 2010 12:15:31 AM
> Subject: Re: [R] Learning ANOVA
>
>
>
> > Performed following steps on R:-
> >
> > ### to access to the object
> >> data(InsectSprays)
> >
> > ### create a .csv file
> >> write.csv(InsectSprays, "InsectSpraysCopy.csv")
> >
> >
> > On another terminal
> > $ sudo updatedb
> > $ locate InsectSpraysCopy.csv
> > /home/userA/InsectSpraysCopy.csv
> >
> >
> > ### Read in some data
> >> test01 <- read.csv(file.choose(), header=TRUE)
> >
> > Enter file name: /home/userA/InsectSpraysCopy.csv
>
> I either don't understand what you're doing, or you seem
> very confused.
>
> R comes with many sample data sets for you to use.
>
> You can see a list of them using the ?data function.
>
> Calling data with an argument loads that dataset.
>
> So, when you type:
>
> > data(InsectSprays)
>
> that data object is now available in R, see
>
> > objects()
>
> You can look at it simply by printing it:
>
> > InsectSprays
>
> If for some reason it makes sense to do it this way for your
> use case, then that's fine, I just want to make sure you understand
> that you don't have to if accessing built-in datasets is all you want.
>
> > ### Look at the data
> >> test01
> > X count spray
> > 1 1 10 A
> > 2 2 7 A
> > 3 3 20 A
>
> <snip>
>
> > ### Create a side-by-side boxplot of the data
> > boxplot(test01$DO ~ test01$Stream)
> > Error in model.frame.default(formula = test01$DO ~ test01$Stream) :
> invalid
> >type (NULL) for variable 'test01$DO'
>
> Why do you think test01 has an element called "D0" or "Stream"?? The
> column names when you print the data tell you otherwise!
>
>
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
>>
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
______________________________________________
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.
More information about the R-help
mailing list