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

From: Ben Tupper <btup...@bigelow.org>
Date: Monday, February 15, 2021 at 8:52 AM
To: Parkhurst, David F. <parkh...@indiana.edu>
Cc: r-sig-mac@r-project.org <r-sig-mac@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()?
Hi,

https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.path.html

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)

Cheers,
Ben


On Mon, Feb 15, 2021 at 8:14 AM Parkhurst, David F. 
<parkh...@indiana.edu<mailto:parkh...@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@r-project.org<mailto:R-SIG-Mac@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


--
Ben Tupper
Bigelow Laboratory for Ocean Science
East Boothbay, Maine
http://www.bigelow.org/
https://eco.bigelow.org


        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to