Installing R, RStudio, and required packages

Step 1: Install R

Download and install R from CRAN:

  • Windows: Click “Download R for Windows” → “base” → download the .exe file
  • Mac: Click “Download R for macOS” → download the .pkg file
  • Linux: Follow instructions for your distribution

Recommended version: R 4.3.0 or later.

Step 2: Install RStudio

Download RStudio Desktop (free) from Posit.

Install and open RStudio. You should see four panels as described in Session 2.

Step 3: Install Required Packages

Open RStudio and run the following code in the Console (bottom-left panel):

Code
# Core packages for the workshop
install.packages(c(
  # Data manipulation and visualization
  "tidyverse",
  "ggplot2",
  "knitr",
  "DT",
  "DiagrammeR",

  # Health economics modelling
  "heemod",
  "dampack",
  "BCEA",

  # Survival analysis
  "survival",
  "survHE",
  "flexsurv",

  # Interactive apps
  "shiny",
  "shinydashboard",

  # Document rendering
  "quarto",
  "rmarkdown"
))

This may take 10-15 minutes depending on your internet connection.

Step 4: Verify Installation

Run this code to check that all packages installed correctly:

Code
packages <- c("tidyverse", "ggplot2", "knitr", "DT", "DiagrammeR", "heemod",
               "dampack", "BCEA", "survival", "survHE", "flexsurv",
               "shiny", "shinydashboard", "quarto", "rmarkdown")

for (pkg in packages) {
  if (require(pkg, character.only = TRUE, quietly = TRUE)) {
    cat("[OK]", pkg, "installed successfully\n")
  } else {
    cat("[FAIL]", pkg, "-- try reinstalling with install.packages('", pkg, "')\n")
  }
}

Step 5: Open the Workshop Project

  1. Download or clone this repository
  2. In RStudio, go to File → Open Project
  3. Navigate to the workshop folder and open HTA-R-Workshop-2026.Rproj
  4. You are ready to begin!

Troubleshooting

“Package not available” error: Your R version may be too old. Update R to version 4.3 or later.

Installation hangs: Try installing packages one at a time instead of all at once.

Behind a proxy/firewall: Ask your IT department for proxy settings, then run:

Sys.setenv(http_proxy = "http://your-proxy:port")
Sys.setenv(https_proxy = "http://your-proxy:port")