They need not only to be here according to the OS, the RStudio working environment, as shown by getwd()
, must also be set to
and keeping the two notions in synch is a bother. The bother can be minimal with
- Create a separate RStudio project for each set of scripts that will use various datasets.
- Create a directory
data
- Copy the
.csv
and `xlsx’ files there; avoid embedded blanks in names - Treat the folder as read-only or include it in
git
or another VCS. - Create a sibling folder
obj
for any transformations to be saved as anrds
object, and preserve the script that performs the transformations install.packages("here")
- Then, whatever working directory is set to, the target can be accessed simply:
read.csv(here::here("data/QVI_purchase_behaviour.csv")