[R] how to read data

William Dunlap wdunlap at tibco.com
Wed Jan 29 20:45:15 CET 2014


If it is not in your working directory you need to
> specify the path by something like.
> 
> file="C:users//documents//R//name.txt"

No, Windows won't like the missing slash after the "C:" and using
a double forward slash is a bad habit to get into on Windows.  Use one of
   "C:\\users\\documents\\R\\name.txt"
or
   "C:/users/documents/R/name.txt"
or
   file.path("C:", "users", "documents", "R", "name.txt")
All put a single slash (backward or forward) between
each component of the file path.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of Vortex
> Sent: Wednesday, January 29, 2014 9:22 AM
> To: r-help at r-project.org
> Subject: Re: [R] how to read data
> 
> chke1993 wrote
> > I don't know the meaning of sep="",and don't know where to add the
> > location of the file such as E//.......
> 
> sep="" means the data you are reading is separated by a white/blank space.
> sep="," would mean it is separated by a comma (,).
> 
> If the file is located in your working directory it is sufficient to put the
> file name including extension in the argument line in quotations
> (file="name.txt"). If it is not in your working directory you need to
> specify the path by something like.
> 
> file="C:users//documents//R//name.txt"
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/how-to-read-data-
> tp4684382p4684400.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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