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

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Nov 5 17:12:40 CET 2009


On Nov 4, 2009, at 8:53 PM, David Winsemius wrote:

>
> 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!

In case anyone didn't know, this also works when using R via the  
terminal (though not as slick).

The difference is that you have to manually move the cursor back  
between the two quotes that you want the file path to appear in before  
you drop the file into the terminal .. still handy to know, though.

-steve

>
> -- 
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-SIG-Mac mailing list