[R-SIG-Mac] Problems loading data file in Mac--How do you specify path name

David Winsemius dwinsemius at comcast.net
Thu Nov 5 02:53:12 CET 2009


On Nov 4, 2009, at 7:00 PM, Duncan Murdoch wrote:

> On 04/11/2009 6:07 PM, Ali S wrote:
>> I have used R in Windows, but am now trying it on a Mac. I am  
>> having problems loading my data as I am not sure how the path names  
>> work. Here is what I have tried and am getting errors with:
>> sfs2<-read.delim(“/Users/fj/Documents/Data/Analysis/ 
>> student2.txt", header
>> = TRUE, sep = "\t")
>
> If that was cut and paste, it looks as though you used the wrong  
> kind of quotes for the open quote.  But the easiest way to get the  
> path right is the same on the Mac as on Windows:  use file.choose()  
> rather than typing it explicitly.

That would work, but....

On the Mac the easiest way to get a correct path (at least in  
Urbanek's GUI version) is to drag and drop. In a console window, set  
up your read function as:

test <- read.table(file="", header = TRUE)

and then activate a Finder window with your target file, and click- 
hold-drag that file so that the cursor is between the quotes and  
release. A properly constructed reference to the file will appear. Mac- 
magic ala Urbanek!

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-SIG-Mac mailing list