Setting Up R, RStudio & Quarto
This guide walks through installing R, RStudio, Quarto, and the core R packages used across the course notes.
1. Installing R and RStudio
R is the statistical computing engine; RStudio is the integrated development environment (IDE) that bundles a script editor, console, plot viewer, and Quarto publishing tools.
Windows
- Download the latest R installer from CRAN and run the
.exefile with default options.



- Download RStudio Desktop from Posit and run the installer.


macOS
- Download the macOS
.pkginstaller matching your processor (Apple Silicon or Intel) from CRAN.



- Download RStudio Desktop for macOS from Posit, open the
.dmg, and drag RStudio to Applications.


2. Installing Course Packages
Install the full suite of packages used across all 32 notes once in the R console:
install.packages(c(
"fpp3", "astsa", "tseries", "urca", "patchwork",
"car", "slider", "janitor", "FinTS", "rugarch",
"vars", "strucchange", "imputeTS"
))

3. Working with Quarto Documents (.qmd)
Quarto comes bundled with recent versions of RStudio (and can also be installed standalone from quarto.org). A .qmd file combines Markdown prose, LaTeX mathematics, and executable R chunks in one reproducible file.
Project Organization
- Create a dedicated folder on your machine (for example,
applied-time-series/). - In RStudio, choose File → New Project → Existing Directory and select that folder. Using an RStudio Project automatically sets the working directory so relative paths such as
"data/google.csv"always work without callingsetwd(). - Place downloaded course CSV/RDS files inside a
data/subfolder.
Essential Quarto Chunk Options
Quarto uses #| YAML comments inside code chunks:
```{r}
#| label: fig-series
#| fig-cap: "Monthly airline passengers (1949–1960)."
#| echo: true
library(fpp3)
as_tsibble(AirPassengers) |> autoplot(value)
```Common options:
#| echo: falsehides code while displaying output and plots.#| include: falseruns setup code silently without showing code or output.#| eval: falsedisplays code without executing it.#| fig-cap: "..."attaches a numbered caption to a figure.
Optional: Display Plots in the Viewer Pane
If you prefer plots and tables to appear in RStudio’s Plots / Viewer pane rather than inline inside the editor:
- Open Tools → Global Options → R Markdown.
- Uncheck Show output inline for all R Markdown documents and click Apply.

