2 Setting up your computer
You will need to have both R and RStudio installed on your computer to complete this workshop. Although it is not imperative that you have the latest version of RStudio installed, you will need to have at least version 4.0 of R installed . Please note that you might need administrative permissions to install these programs. After installing them, you will also need to install some R packages too. Finally, you will also need to download the data for this workshop.
2.1 R
The R statistical computing environment can be downloaded from the Comprehensive R Archive Network (CRAN). Specifically, you can download the latest version of R (version 4.2.3) from here: https://cloud.r-project.org. Please note that you will need to download the correct file for your operating system (i.e. Linux, Mac OSX, Windows).
2.2 RStudio
RStudio is an integrated development environment (IDE). In other words, it is a program that is designed to make your R programming experience more enjoyable. During this workshop, you will interact with R through RStudio—meaning that you will open RStudio to code in R. You can download the latest version of RStudio here: http://www.rstudio.com/download. When you start RStudio, you will see two main parts of the interface:
You can type R code into the Console and press the enter key to run code.
2.3 R packages
An R package is a collection of R code and documentation that can be installed to enhance the standard R environment with additional functionality. Currently, there are over fifteen thousand R packages available on CRAN. Each of these R packages are developed to perform a specific task, such as reading Excel spreadsheets, downloading satellite imagery data, downloading and cleaning protected area data, or fitting environmental niche models. In fact, R has such a diverse ecosystem of R packages, that the question is almost always not “can I use R to …?” but “what R package can I use to …?”. During this workshop, we will use several R packages. To install these R packages, please enter the code below in the Console part of the RStudio interface and press enter. Note that you will require an Internet connection and the installation process may take some time to complete.
install.packages(c("sf", "terra", "dplyr", "sp", "rgeos", "rgdal", "raster",
"units", "tidyr", "stringr", "readr", "transformr", "data.table",
"ggplot2", "RColorBrewer", "rnaturalearth", "rnaturalearthdata",
"ggtext", "lwgeom", "patchwork", "gganimate", "animation"))
# Optional packages
# library(ncdf4)
# library(ncdf4.helpers)
# library(PCICt)
# library(magrittr)
# library(exactextractr)
# library(nngeo)