[R-SIG-Mac] import data Mac OS

William Revelle lists at revelle.net
Fri May 6 15:51:41 CEST 2011


At 12:40 PM +0100 5/6/11, Prof Brian Ripley wrote:
>On Mon, 2 May 2011, Ben Bolker wrote:
>
>>On 05/02/2011 09:28 AM, Thor Jensen wrote:
>>>Hello,
>>>
>>>I am unable to write a pathway to .csv files saved on my computer.  I
>>>can get this to work on a windows machine, but the mac returns a
>>>message saying the file does not exist.  Any tips on how to import
>>>data on mac's?  For example, the below line was unsuccesful.
>>>read.csv(file="Macintosh HD:Users:ThorJ:Desktop:heightweight.csv"
>>>
>>>Many thanks,
>>>
>>>Thor
>>>
>>   Try working your way to the file interactively within R using
>>
>>(fn <- file.choose())
>>
>>  and see what R thinks the file is really called.
>
>On a Mac that can be confusing since there are so many links (try 
>finding files under /tmp for example).
>
>Assuming this is Mac OS X, the file is most likely called 
>"/Users/ThorJ/Desktop/heightweight.csv": Classic MacOS (which used 
>:) was

If you use file.choose() then the Mac opens a search window where you 
can type in partial name of the file (heightweight) and it will find 
all files with the name of heightweight.  Select the one you want.

An alternative to reading csv file directly is to read them from 
Excel (or OpenOffice), copy them to the clipboard and then

library(psych)
my.data <- read.clipboard.csv()

Bill



>last supported several years ago.
>
>--
>Brian D. Ripley,                  ripley at stats.ox.ac.uk
>Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>University of Oxford,             Tel:  +44 1865 272861 (self)
>1 South Parks Road,                     +44 1865 272866 (PA)
>Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
>_______________________________________________
>R-SIG-Mac mailing list
>R-SIG-Mac at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list