You need to assign your data set to something -- right now you're just reading it in and then throwing it away:
dats <- read.csv("mydata1.csv") mean(dats$X) # Dollar sign, not ampersand Best, Michael On Tue, May 15, 2012 at 8:57 AM, jacaranda tree <myjacara...@yahoo.com> wrote: > Hi I am really new using R, so this is really a beginner stuff! I > created a very small data set on excel and then converted it to .csv > file. I am able to open the data on R using the command "read.table > ("mydata1.csv", sep=",", header=T)" and it just works fine. But when I > want to work on the data (e.g. calculate the mean of variable "X") R > says "object not found". I tried the "attach" command or "mean > ("mydata1.csv"&X)" but still I get the same error message. I don't > understand why R is having difficulty finding a variable. I believe I am > doing something wrong. I will really appreciate if you could help me > with this. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.