2  Software

In this chapter we will guide you through the installation of R, RStudio and the packages you will need for this course.

R and RStudio1 are separate downloads.

2.1 R

You will need R installed on your computer. R stats (how it is also known) is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing.

The download links live at The Comprehensive R Archive Network (aka CRAN). he most recent version is 4.5.1, but you can use >= 4.1.x if you already have it installed.

After this installation, you don’t need to open R base. Please proceed to install RStudio.

2.2 RStudio

RStudio Desktop is an integrated development environment (IDE) for R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management.

RStudio is available for free download from Posit RStudio.

2.3 R packages

You will need to install some packages to work with the data and scripts in this course.

You can install them in RStudio by searching for them in the Packages tab:

or by running the following code in the console:

install.packages("tidyverse")
install.packages("readxl")

install.packages("sf")
install.packages("mapview")
install.packages("rmarkdown")
install.packages("centr")
install.packages("od")
install.packages("openrouteservice")

install.packages(c("remotes", "devtools", "usethis")) # optional
install.packages("osmextract") # optional
install.packages("stplanr") # optional

2.4 TinyTex

To be able to export your Rmakdown document to a pdf file, you will need a LaTeX processor. tinytex is a lightweight R package with the most used features of LaTeX that you can use with R.

You can install it from RStudio console by running:

# you need to run both lines
install.packages("tinytex")
tinytex::install_tinytex()

To use some LaTeX packages, you also need to install tlmgr.

tinytex::tlmgr_install()
tinytex::tlmgr_update() # updates all latex pkgs

2.5 Open Route Service

For some GIS exercises, we will use the Open Route Service to calculate routes and travel times.

In RStudio console, run:

# install.packages("openrouteservice")

# instructions to setup at the U-Shift server
options(openrouteservice.url = "https://...") # the server address provided to you
openrouteservice::ors_api_key("") # empty key

  1. We will use RStudio, although if you already use other studio such as VScode, that’s also fine.↩︎