[R] How to import an excel data file

Stevie Pederson @tephen@peder@on@@u @end|ng |rom gm@||@com
Sat Sep 23 13:28:17 CEST 2023


Hi David,

If you're using RStudio, I'd encourage the use of R Projects, with a new
project for each analysis, even if you only do one every few years. That
would also correspond to a new directory for each analysis, which many also
find helpful. The package 'here' [install.packages("here")] then uses the
.Rproj file to set file paths within each project. You can place your data
somewhere within the parent directory of the project and use
here::here("relative/path/to/my_file.csv") to tell R where the file is. It
sounds like a trivial step, but it really can make referring to files on
disk like this much easier.

I'm not sure what the best parent folder would be for your analysis, but
assuming it's FriendsMonroe, you would start a new R Project in that
directory, keep all of your scripts in that directory, and refer to the
file using here::here("KurtzData.csv")

I do hope that helps,

Stevie

On Sat, 23 Sept 2023 at 17:53, Parkhurst, David <parkhurs using indiana.edu>
wrote:

> I know I should save it as a .csv file, which I have done.
> I’m told I should use the read_excel() function from the readxl package.
> My question is, how do I express the location of the file.  The file is
> named KurtzData.csv.
> Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv
> How exactly---What “, etc.---do I type with its name in the read_excel()
> function?
> It’s been a long time since I’ve used R.
> Thanks for any help.
>
>
>
>
>
>
>         [[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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list