diff --git a/learners/setup.md b/learners/setup.md index db1654e4..47742e35 100644 --- a/learners/setup.md +++ b/learners/setup.md @@ -2,20 +2,90 @@ title: Setup --- - +R and RStudio are two separate pieces of software: -## Software Setup +* **R** is a programming language and software used to run code written in R. +* **RStudio** is an integrated development environment (IDE) that makes using R easier. In this tutorial, we use RStudio to interact with R. + +If you don't already have `R` and `RStudio` installed, follow the instructions for your operating system at . + +### Update R and RStudio + +This tutorial requires R version 4.0.0 or later. + +If you already have R and RStudio installed, first check if your R version is up to date: + +* When you open RStudio your R version will be printed in the console on the [console window](https://docs.posit.co/ide/user/ide/guide/code/console.html). Alternatively, you can type `sessionInfo()` into the console. + +* If your version of R is older than the one required, download and install the latest version of R from the [R project website](https://cran.rstudio.com/) for your operating system. + +* After installing a new version of R, you will have to reinstall all your packages with the new version. For Windows, there is a package called `installr` that can help you with upgrading your R version and migrating your package library. + +* To update RStudio to the latest version, open RStudio and click on +`Help > Check for Updates`. If a new version is available follow the +instructions on the screen. By default, RStudio will also automatically notify you +of new versions every once in a while. + +::::::::::::::::::::::::::::: callout + +While this may sound scary, it is **far more common** to run into issues due to using out-of-date versions of R or R packages. Keeping up with the latest versions of R, RStudio, and any packages you regularly use is a good practice. + +::::::::::::::::::::::::::::: + +### Install required R packages + +During the tutorial, we will need a number of R packages. Packages contain useful R code written by other people. We will use packages from the [Epiverse-TRACE](https://epiverse-trace.github.io/). + +To try to install these packages, open RStudio and copy and paste the following code chunk into the [console window](https://docs.posit.co/ide/user/ide/guide/code/console.html), then press the Enter (Windows and Linux) or Return (MacOS) to execute the command. + +```r +if(!require("pak")) install.packages("pak") + +new_packages <- c( + "EpiNow2", + "epiverse-trace/epiparameter", + "socialmixr", + "epiverse-trace/epidemics", + "tidyverse" +) + +pak::pak(new_packages) +``` + +You should update **all of the packages** required for the tutorial, even if you installed them relatively recently. New versions bring improvements and important bug fixes. + +When the installation has finished, you can try to load the packages by pasting the following code into the console: + +```r +library(EpiNow2) +library(epiparameter) +library(socialmixr) +library(epidemics) +library(tidyverse) +``` + +If you do NOT see an error like `there is no package called ‘...’` you are good to go! If you do, [contact us](#your-questions)! + +## Data sets + +### Download the data + +We will download the data directly from R during the tutorial. However, if you are expecting problems with the network, it may be better to download the data beforehand and store it on your machine. + +The data files for the tutorial can be downloaded manually here: + +- -Install R and Rstudio +## Your Questions +If you need any assistance installing the software or have any other questions about this tutorial, please send an email to