[R] data import (on macintosh)

Luke Whitaker luke at inpharmatica.co.uk
Tue Jan 14 16:38:07 CET 2003


I think the problem is the way files are named on the Macintosh.

On the Mac, the file separator character, which is "/" on unix
and "\" on dos/windows, is ":". Also, the root directory doesn't
start with the separator character, but instead just starts
with the volume name, which is the name of the hard disk icon
on your desktop, so if your file is in the top level directory
of your hard disk, and your hards disk is called for example
"My Mac HD", then you would want something like

 > guilds <- read.table(file = "My Mac HD:untitled.teste.txt")

If the file was in a sub-folder called "my folder", then you would want:

 > guilds <- read.table(file = "My Mac HD:my folder:untitled.teste.txt")

The "current directory" is probably the directory (folder)
that contains the R application, and if your data file is in
the same folder, then you don't need anything except its name:

 > guilds <- read.table(file = "untitled.teste.txt")

Also, I think from memory, that the "parent directory", which would
be "../" on unix or "..\" on dos/windows, is "::" on the mac, so that

 > guilds <- read.table(file = "::untitled.teste.txt")

would probably be the folder one level above the one containing the R
application.

NB All the above refers to Mac OS 7, 8, or 9. The new Mac OS X
is essentially unix, and I would expect that normal unix file
name conventions should apply, unless there is some backwards
compatibility fix for "carbon" applications, but I'm not sure
about that. There are two different versions of R available on
Mac OS X, one is pure unix running under the X11 window system,
and the other is a carbon application using the native Macintosh
windowing system, so they might behave differently.

I hope this helps,

Luke Whitaker




More information about the R-help mailing list