[R] How to Import Data

Jacques VESLOT jacques.veslot at cirad.fr
Tue Feb 21 15:05:39 CET 2006


select the directory with setwd() and then import data:

setwd("d:/.../yourdirectory")
x111 <- read.table("x111.csv",...)

or indicate path behind filename:
x111 <- read.table("d:/.../yourdirectory/x111.csv",...)

besides, there are other functions to import data.
see ?read.table




Carl Klarner a écrit :

>Hello,
>I am a very new user of R.  I've spent several hours trying to import
>data, so I feel okay asking the list for help.  I had an Excel file,
>then I turned it into a "csv" file, as instructed by directions.  My
>filename is "x111.csv."  I then used the following commands to read this
>(fairly small) dataset in.  
>
>x111 <-read.table(file='x111.csv',
>sep="",header=T,
>quote="",comment.char="",as.is=T)
>
>I then get the following error message.
>
>Error in file(file, "r") : unable to open connection
>In addition: Warning message:
>cannot open file 'x111.csv', reason 'No such file or directory'
>
>I would imagine I'm not putting my csv file in the right location for R
>to be able to read it.  If that's the case, where should I put it?  Or
>is there something else I need to do to it first?
>Thanks for your help,
>Carl
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>  
>




More information about the R-help mailing list