[R] reading data into R

Ivan Calandra ivan.calandra at u-bourgogne.fr
Tue May 15 15:41:47 CEST 2012


Hi !

You need to assign the output of read.table() into an object; this is 
how R works:
mydata <- read.table ("mydata1.csv", sep=",", header=T)
mymean <- mean(mydata$var)

You should read some introductory material.
I found this useful: 
http://www.burns-stat.com/pages/Tutor/hints_R_begin.html
And then, there are tons of good books and documentation (go check the 
CRAN as well)

HTH,
Ivan

PS: post in plain text

--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra


Le 15/05/12 14:57, jacaranda tree a écrit :
> 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 at 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.
>
>



More information about the R-help mailing list