[R] reading data into R

Rui Barradas ruipbarradas at sapo.pt
Tue May 15 15:08:05 CEST 2012


hello,

The error message is right, you have read the file have NOT assigned it to
an object, to a variable.


mydata1 <- read.table ("mydata1.csv", sep=",", header=T)

Now you can use the variable 'mydata1'. It's a data.frame, and you can see
what it looks like with the following instructions.

str(mydata1)            # str for structure
head(mydata1)       # default is first 6 lines


Note also that you could have called your dataset a name different from the
filename.


> mean ("mydata1.csv"&X)

Where have you found that syntax???
Correct

mean(mydata1$X)
mean(mydata1[ , "X" ])

You should read R-intro.pdf, it comes with any installation of R, folder
doc.
There are obvious "beginner stuff" things you could quickly learn.

Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/reading-data-into-R-tp4630069p4630071.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list