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

Parkhurst, David F. p@rkhur@ @end|ng |rom |nd|@n@@edu
Mon Feb 15 15:42:05 CET 2021

Wow.  That looks useful, especially when I don�t want to put the file to be read on the desktop.  Thanks.

From: Ben Tupper <btupper using bigelow.org>
Date: Monday, February 15, 2021 at 8:52 AM
To: Parkhurst, David F. <parkhurs using indiana.edu>
Cc: r-sig-mac using r-project.org <r-sig-mac using r-project.org>
Subject: Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?


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 following...

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<mailto:parkhurs using indiana.edu>> wrote:
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<mailto:R-SIG-Mac using r-project.org>

Ben Tupper
Bigelow Laboratory for Ocean Science
East Boothbay, Maine

	[[alternative HTML version deleted]]

More information about the R-SIG-Mac mailing list