[R] Learning ANOVA
Erik Iverson
eriki at ccbr.umn.edu
Fri Aug 13 18:15:31 CEST 2010
> 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!
More information about the R-help
mailing list