Greg.Snow at imail.org
Thu May 27 16:50:53 CEST 2010
Others pointed out that the error message is due to ozon being a data frame, but I think the true source of confusion comes a bit earlier. You really need to understand more about data objects and the search path.
You first read in a table and name it tab1.
Then you attach tab1 to the search path (there are better ways than attach now, while it can be a useful tool, it can also easily lead to problems like you are seeing).
The warning from attach tells you that there are now 2 things in the search path with the name ozon, one of which is an object in the global environment, the other is one of the columns of tab1. The warning also tells you that the object in the global environment masks (or will take precedence over) the tab1 column.
You then print out 'v1' column of the ozon object (which has nothing to do with the ozon column in tab1).
Then you do the Shapiro test, I would assume given that you show us reading in and attaching tab1 that you want the test done on the ozon column of tab1, but R finds the ozon object in the global environment before it finds the column in tab1 and you get the error.
Remember that computers are stupid, they do exactly what they are told to do, so tell R exactly what you want it to do. Either remove the ozon object so that it is not found first, or use commands like:
> with(tab1, shapiro.test(ozon))
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Stefan Scheurer
> Sent: Wednesday, May 26, 2010 1:37 PM
> To: r-help at r-project.org
> Subject: [R] shapiro.test
> I am not so sure about an error note I got when using shapiro.test.
> I imported some data into R by wrinting it into a .txt file via
> > tab1<-read.table("etc....txt",header=T)
> > attach(tab1)
> The following object(s) are masked _by_ .GlobalEnv :
> > ozon$V1  2.5 3.0 5.6 4.7 6.5 6.7 1.7 5.3 4.6 7.4 5.4 4.1 5.1 5.6
> 5.4 6.1 7.6 6.2 6.0 5.5 5.8 8.2 3.1 5.8 2.6
> Now I wanted to use the shapiro.test:
> > shapiro.test(ozon)
> Fehler in sort.list(x[complete.cases(x)]) : 'x' must be atomic for
> 'sort.list'Have you called 'sort' on a list?
> Can anyone help please?
> Best regards
> Hotmail: Leistungsstarke kostenlose E-Mails mit Sicherheit von
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help