On Jul 16, 2009, at 6:32 AM, caballo wrote:
Hello,
Please forgive me that this question is so basic, but i have not
been able
to find a solution in any of the basic R introductions, in the R
wiki, or in
the stats textbook i'm using to learn R. I run R on a macintosh, and
i have
not been able to load any data files yet. For instance, if I have a
data
table in a file called schools.txt on my desktop, i've been trying
to load
the table as such:
schools <-
read.table("c:\harddrivename\users\username\desktop\schools.txt",
header=T,row.names=1)
(obviously for the purposes of posting in this forum i've entered
generic
folder names.)
No matter how i ammend the path, i get the following error message:
Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") :
cannot open file 'c:\harddrivename\users\username\desktop
\schools.txt':
No such file or directory.
I'm guessing that there's a different way to enter the path name on a
macintosh?
Thanks for your help!
You are using a Windows based file path and on Windows, you would need
to double the backslashes. See:
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#R-can_0027t-find-my-file
On OSX, there is no "C:" drive and you would use forward slashes. The
typical file path on OSX would be:
/Users/username/Desktop/schools.txt
If you are using the OSX GUI (R.app) you may also want to review the
OSX FAQ:
http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#R_002eapp
There is a Mac/OSX specific R e-mail list, which you should consider
subscribing to. More info:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
As it sounds like you are new to Macs and will be spending more time
on them, you might also consider picking up a good Intro to OSX book,
of which there are many. Check your local bookstore or Amazon. Pogue's
books have generally worked well for folks:
http://www.amazon.com/Mac-OS-Leopard-Missing-Manual/dp/059652952X
http://www.amazon.com/Switching-Mac-Missing-Manual-Leopard/dp/0596514123/
HTH,
Marc Schwartz
______________________________________________
[email protected] 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.