[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-mac
Subject:    Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?
From:       "Parkhurst, David F." <parkhurs () indiana ! edu>
Date:       2021-02-15 14:42:05
Message-ID: BN7PR08MB41144275A103D052C86C11D1D0889 () BN7PR08MB4114 ! namprd08 ! prod ! outlook ! com
[Download RAW message or body]

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

From: Ben Tupper <btupper@bigelow.org>
Date: Monday, February 15, 2021 at 8:52 AM
To: Parkhurst, David F. <parkhurs@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 i=
n 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 th=
e 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. <parkhurs@indiana.edu<m=
ailto:parkhurs@indiana.edu>> wrote:
I=92ve tried for over an hour to figure this out with no luck.  I=92ve move=
d 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 =93Where=94 as  iCloud Dr=
ive > 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 i=
f I try read.table("\\Users\\DFP\\Desktop\\Monroe319Ecoli.txt"), I get No s=
uch 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic