[R] reading data into R

John Kane jrkrideau at inbox.com
Tue May 15 15:41:15 CEST 2012


What was the exact syntax?
 read.table> ("mydata1.csv", sep=",", header=T)
will read the data but not save anything.

mydat <-read.table ("mydata1.csv", sep=",", header=T)
give you a data.frame called mydat.

mean(mydat$X)  should give you the mean of X  




John Kane
Kingston ON Canada


> -----Original Message-----
> From: myjacaranda at yahoo.com
> Sent: Tue, 15 May 2012 05:57:51 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] reading data into R
> 
> 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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!



More information about the R-help mailing list