- Download R 4.0.5.
R is constantly evolving software, with new versions being made available regularly. To make sure all codes are reproducible, we set version 4.0.5. as the version used for this textbook.
To start working in R, please download version 4.0.5 from below. After download, double-click the file and follow the instructions. (If you are using a newer version of R, codes shall all work, but there is no guarantee.)
- We suggest to use R Studio as editor for R code. (There many other options, too.) You can get R Studio for free.
How to run case studies in R
Set the working directory for your project
In case you use
RStudiocreate a new
Rstudioproject for the case studies and load it every time you are working on the project. See the official documentation on how to create and use
Install required packages
We use renv for dependency management. Open the R project you created in Step 1., and install
renvby running the following command in the R studio consol:
then install all the packages and dependencies used in the case studies stored in the
Set project path
You will need to set the path to the data repo and save it in the
set-data-directory.Rfile. a. Open
set-data-directory-example.Rand add your path to the data repo where you have or will download datasets. b. Save as
set-data-directory.R(exactly where you found