<- c(
list.of.packages.cran "igraph",
"sf",
"tidyverse",
"ggplot2",
"ggraph",
"patchwork",
"tidygraph",
"RColorBrewer",
"rnaturalearth"
)
<- list.of.packages.cran[!(list.of.packages.cran %in% installed.packages()[,"Package"])]
new.packages.cran if(length(new.packages.cran)) install.packages(new.packages.cran)
for(i in 1:length(list.of.packages.cran)) {
library(list.of.packages.cran[i], character.only = T)
}
1 Prerequisites
Please make sure you download and install the most recent version of R, RStudio and Quarto on the computer that you will be using during the workshop, and install the indicated R packages – see detailed instructions below.
All three software packages are open and free to use.
R
You can download R here. Make sure you select the appropriate version for your Operating System: Windows, MacOS (Apple silicon M1/M2 or older intel Macs). For example, if you use a macOS laptop with an M1 processor, click on ‘Download R for macOS’ and then, click the link to download the installer file (.pkg extension for macOS) under the header ‘For Apple silicon (M1/M2) Macs’. You can then open the installer and follow the instructions that you will be prompted with. For Windows users, click on ‘install R for the first time’ and follow the prompts.
RStudio
You will also need to download RStudio Desktop (or simply RStudio), which is an integrated development environment to help you write code in R more easily. To download RStudio, follow this link and scroll down to the section titled ‘All Installers and Tarballs’. Download the appropriate installer file according to your Operating System. Then, open the installer and follow the installation instructions that you will be prompted with.
Quarto
Download Quarto from this website. Quarto is a publishing system that will allow you to open and work on the computational notebooks for the workshop. On ‘Step 1’ on the website, download the version of Quarto that matches your Operating System. Open the installer file, run it and follow the prompts.
R packages
Once you have installed R, you will need to install some R extensions, known as packages, that will be useful for the applications explored in this workshop. In this case, you only need to install one package:
igraph
sf
tidyverse
ggplot2
ggraph
patchwork
tidygraph
RColorBrewer
rnaturalearth
To install any package, open RStudio. On the console window (normally at the bottom left), write the following command: install.packages("name of package")
. Make sure you replace “name of package” by the actual name of the package that you want to install e.g. install.packages("tidyverse")
. Then, press enter and repeat this process until you have installed all the packages in the list.
If there are several packages you need to install, you can also install them all at once by copying and running the code below:
Once your packages are installed, you will need to load them in order to be able to use it in your code. This can be done by copying and running the code below:
<- list(
deps "igraph",
"sf",
"tidyverse",
"ggplot2",
"ggraph",
"patchwork",
"tidygraph",
"RColorBrewer",
"rnaturalearth"
)
for(lib in deps){library(lib, character.only = TRUE)}
Or you can load them one by one simply running, for example, library(igraph)
for igraph
.
Further instructions on how to download the workshop material from Github will be given during the workshop.