Installation

To follow the workshop, you should have the following programs installed on your machine before the day of the workshop.

  • R and RStudio
  • A few R packages
  • Java JDK 21

See instructions below:

Installing R and RStudio

We assume you already have R and RStudio installed on your machine. In case you don’t, follow these simple instructions here.

Installing R packages

The workshop uses a few R packages that need to be installed on your machine. The simplest way to do this is running the code below. This might take a few minutes if this is the first time you install these packages.

pkgs <- c(
  'r5r',
  'accessibility',
  'ggplot2',
  'mapview',
  'dplyr',
  'h3jsr',
  'sf'
  )

install.packages(pkgs)

The safest way to replicate the code of this workshop, though, is cloning its repository locally. This is because this repository uses the {renv} R package to manage the package dependencies of the code we use. This is important to make sure we are using the same versions of the relevant packages.

Once you have cloned the repo and you’ve opened the access_workshop_bogota_2024.Rproj file, you can simply run renv::restore() to install all the package dependencies used in this workshop.

# uncomment the line below in case you need to install the {renv} package
# install.packages('renv')
renv::restore()

Installing Java

To use the {r5r} package (version v2.0 or higher), you will need to have Java Development Kit (JDK) 21 installed on your computer. There are numerous open-source JDK implementations. The easiest way to install JDK is using the new {rJavaEnv} package in R, developed by Egor Kotov (thanks Egor!).

# install {rJavaEnv} from CRAN
install.packages("rJavaEnv")

# check version of Java currently installed (if any) 
rJavaEnv::java_check_version_rjava()

## if this is the first time you use {rJavaEnv}, you might need to run this code
## below to consent the installation of Java.
# rJavaEnv::rje_consent(provided = TRUE)

# install Java 21
rJavaEnv::java_quick_install(
  version = 21,
  distribution = 'Corretto')

# check if Java was successfully installed
rJavaEnv::java_check_version_rjava()

Alternatively, you can manually download and install any of these JDK implementations:

Here are a few accompanying slides explaining the computational requirements to conduct transport routing and accessibility analysis with R.