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. <parkhurs at 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 at 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]]