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
.csvand `xlsx’ files there; avoid embedded blanks in names - Treat the folder as read-only or include it in
gitor another VCS. - Create a sibling folder
objfor any transformations to be saved as anrdsobject, 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")