Hi, We've written an R program to conduct a series of analyses on a data file that is a comma separated value file. At one time it worked, but every since having down loaded the new version of R, I'm getting the following: Cannot open c:windowsdesktopslope.csv What I've asked the program to do is to open a datafile using the following: DataFile<- 'c:\windows\desktop\slope.csv' So it is clearly stripping the "\" from the path. I've tried using "/" to no avail. Any suggestions? Paul Paul J. Yoder, Ph.D. Peabody Box 328 Vanderbilt University Nashville, TN 37215 phone: 615-322-8464 fax: 615-322-8236 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Jun-17 21:59 UTC
[R] trouble getting R program to open a data file
Paul Yoder <paul.yoder at vanderbilt.edu> writes:> Hi, > We've written an R program to conduct a series of analyses on a data file > that is a comma separated value file. At one time it worked, but every > since having down loaded the new version of R, I'm getting the following: > > Cannot open c:windowsdesktopslope.csv > > > What I've asked the program to do is to open a datafile using the following: > > DataFile<- 'c:\windows\desktop\slope.csv' > > So it is clearly stripping the "\" from the path. I've tried using "/" to > no avail. Any suggestions?"/" should work, or "\\" -- if the file is actually there, of course. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Windows, you need to use "\\" instead of a single "\". To avoid this problem in the future (and to be platform independent), you might consider doing: DataFile <- file.path("c:", "windows", "desktop", "slope.csv") which will insert the appropriate directory separator for you. -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Mon, 17 Jun 2002, Paul Yoder wrote:> Hi, > We've written an R program to conduct a series of analyses on a data file > that is a comma separated value file. At one time it worked, but every > since having down loaded the new version of R, I'm getting the following: > > Cannot open c:windowsdesktopslope.csv > > > What I've asked the program to do is to open a datafile using the following: > > DataFile<- 'c:\windows\desktop\slope.csv' > > So it is clearly stripping the "\" from the path. I've tried using "/" to > no avail. Any suggestions? > > Paul > Paul J. Yoder, Ph.D. > Peabody Box 328 > Vanderbilt University > Nashville, TN 37215 > phone: 615-322-8464 > fax: 615-322-8236 > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._