[R] File names for mac newby

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Wed Jan 22 16:17:23 CET 2020


Use ?file.choose to choose a file interactively and avoid typing paths:

read.table(file.choose(), header = TRUE, etc....)

will open a finder window to navigate to and click on the file you want.

-- Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Jan 21, 2020 at 11:53 PM R. Mark Sharp via R-help <
r-help using r-project.org> wrote:

> Open the terminal application in the Utilities folder. Select the file you
> want to use in R in a Finder window and drag it to the terminal
> applications command line prompt and then release the file. The absolute
> path of the file will be entered in the command line of the terminal’s
> window. Though this absolute path will work, relative paths are often
> preferred.
>
>
> Mark
>
> R. Mark Sharp, Ph.D.
> rmsharp using me.com
>
> > On Jan 21, 2020, at 2:02 PM, Kevin Thorpe <kevin.thorpe using utoronto.ca>
> wrote:
> >
> > You would also need to drop the c: as that is a DOS/Windows thing.
> >
> > --
> > Kevin E. Thorpe
> > Head of Biostatistics,  Applied Health Research Centre (AHRC)
> > Li Ka Shing Knowledge Institute of St. Michael's
> > Assistant Professor, Dalla Lana School of Public Health
> > University of Toronto
> > email: kevin.thorpe using utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016
> >
> >
> > On 2020-01-21, 1:26 PM, "R-help on behalf of James Spottiswoode" <
> r-help-bounces using r-project.org on behalf of james using jsasoc.com> wrote:
> >
> >    OSX is based on BSD UNIX so paths use the forward slash as separator,
> e.g.
> >
> >    temps <-
> read.table("c:/Users/DFP/Documents/ah/house/HouseTemps.txt",header=T,row.names=1)
> >
> >    Best James
> >
> >> On Jan 21, 2020, at 9:20 AM, David <parkhurs using indiana.edu> wrote:
> >>
> >> I moved to a mac a few months ago after years in windows, and I'm still
> learning basics.  I'm wanting to create a data frame based on a text file
> called HouseTemps.txt.  That's a file within one called house which is
> within one called ah.  That may further be in one called  Documents.  I
> tried various lines like:
> >>
> >> temps <-
> read.table("c:\\Users\\DFP\\Documents\\ah\\house\\HouseTemps.txt",header=T,row.names=1)
> >>
> >> based on my windows DOS experience, but nothing I try works.  So my
> question is, what do complete file names look like in a mac?
> >>
> >> I tried Apple support, but they couldn't help me with R.
> >>
> >> ______________________________________________
> >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> >        [[alternative HTML version deleted]]
> >
> >    ______________________________________________
> >    R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >    https://stat.ethz.ch/mailman/listinfo/r-help
> >    PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >    and provide commented, minimal, self-contained, reproducible code.
> >
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list