[R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?

Ben Tupper btupper @end|ng |rom b|ge|ow@org
Mon Feb 15 14:52:24 CET 2021



See the note at the bottom.  It's liberating in many ways that R handles
the underlying details for you - use the forward slash and you'll be good
to go without regard to the platform.

I think using file.path() is the best way to go. Just do something like the

filename <- file.path("Users", "DFP",  "Desktop",  "Monroe319Ecoli.txt")
x <- read.table(filename)


On Mon, Feb 15, 2021 at 8:14 AM Parkhurst, David F. <parkhurs using indiana.edu>

> I’ve tried for over an hour to figure this out with no luck.  I’ve moved
> the text file (created from excel) to the desktop to simplify the path.  If
> I click on the file and ask Get Info, it lists “Where” as  iCloud Drive >
> Desktop.  If I copy that to the clipboard and paste that into a read.table
> command in the R interface, it comes up as /Users/DFP/Desktop.  But if I
> try read.table("\\Users\\DFP\\Desktop\\Monroe319Ecoli.txt"), I get No such
> file or directory.  How can I get that file into a data frame?
>         [[alternative HTML version deleted]]
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Ben Tupper
Bigelow Laboratory for Ocean Science
East Boothbay, Maine

	[[alternative HTML version deleted]]

More information about the R-SIG-Mac mailing list