[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:34:29 CET 2021

Thanks.  As I’ve said elsewhere, I thought I had seen in something I read that those double backslashes were required in a Mac. 

From: Peter Dalgaard <pdalgd using gmail.com>
Date: Monday, February 15, 2021 at 8:31 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()?
Just use forward slashes, backslashes is a Windows thing. I.e.


should do it. A generic trick is

x <- file.choose()
dd <- read.table(x)

(and then possible have a look at x)


> On 29 Jan 2021, at 21:25 , Parkhurst, David F. <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
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com

More information about the R-SIG-Mac mailing list