Hello, I am a newbie to R. I would like to test my data for normality using the Shapiro-Wilks test. How do I go about it ? My data is in form of a table with 2 columns - colA, colB and I want to know if colB values are a normal distribution. First I read the data into R using d <- read.table("tab.dat",header=T) Then if I type shapiro.test(d) I get the error message: Error in "[.data.frame"(x, complete.cases(x)) : undefined columns selected and if I type shapiro.test(d.colB) I get message: Error in inherits(x, "factor") : Object "d.colB" not found What is the correct syntax and how do I obtain this syntax from any help documentation ? Any suggestion is greatly appreciated. Thanks Sukhaswami Malladi *************************************************************************** The contents of this communication are intended only for the addressee and may contain confidential and/or privileged material. If you are not the intended recipient, please do not read, copy, use or disclose this communication and notify the sender. Opinions, conclusions and other information in this communication that do not relate to the official business of my company shall be understood as neither given nor endorsed by it. *************************************************************************** -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> My data is in form of a table with 2 columns - colA, colB and > I want to know if colB values are a normal distribution. > > First I read the data into R using > d <- read.table("tab.dat",header=T) > > Then if I type > shapiro.test(d) > > I get the error message: > > Error in "[.data.frame"(x, complete.cases(x)) : > undefined columns selected > > and if I type > shapiro.test(d.colB) > > I get message: > > Error in inherits(x, "factor") : Object "d.colB" not found > > What is the correct syntax and how do I obtain this syntax > from any help > documentation ?I believe that the problem that you are having is that in the first example, you are trying to have the test performed on a data frame (data in the form of rows and columns) rather than a data vector (a single column of data), which is what the function requires. In the second example, you need a different syntax to refer specifically to "colB" as a data vector within your frame. If you use the format: shapiro.test(d$colB) it should work. Note the use of the "$" to refer to the column within the frame. You can type "help(shapiro.test)" to access the help for this particular function. You will note that the "x" argument in the function syntax is defined as a numeric vector. You can also access the general documentation via the Help menu or by typing "help.start()". These options will provide you with access to the .PDF and .HTML manuals and associated documentation to review some of the basic R concepts and examples. You may wish to start with the "Introduction to R", which covers the basics. Regards, Marc -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Sukhaswami Malladi <smalladi at lexgen.com> writes:>Hello, > >I am a newbie to R. I would like to test my data for normality using the >Shapiro-Wilks >test. How do I go about it ? > >My data is in form of a table with 2 columns - colA, colB and I want to know >if >colB values are a normal distribution. > >First I read the data into R using >d <- read.table("tab.dat",header=T) > >Then if I type >shapiro.test(d) > >I get the error message: > >Error in "[.data.frame"(x, complete.cases(x)) : > undefined columns selected > >and if I type >shapiro.test(d.colB) > >I get message:I think you mean: shapiro.test(d$colB) Mark -- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._