[R] loading a file in R in mac OS X
David Winsemius
dwinsemius at comcast.net
Thu Jul 16 15:16:01 CEST 2009
On Jul 16, 2009, at 8:44 AM, Marc Schwartz wrote:
> 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,
snipped further useful information that does not need repeating:
Two further suggestions for a new Mac user;
a) this should have been posted to r-sig-mac:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
b) If you click-drag a file from the Finder to the R-console, you will
get a properly constructed full file specification. I generally
construct a landing zone with two apostrophes and thennavigate the
cursor until is sits between them:
read.table("", header=T,row.names=1)
.... and please do read the Posting Guide.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list