Skip to content
Introduction to R Markdown
TeX Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Introduction to rmarkdown

This is a 1h-1h30 workshop given at UCSB (Eco-Data-Science Group and Center for Scientific Computing (CSC))

There are 2 main documents:

Preparing the workshop

Required software

We will primarily be using a web browser, R, RStudio. Please be sure these are all installed on your laptop, as follows:

  • R: We will use the lastest R version, which you can download and install from CRAN

  • RStudio: RStudio is an excellent front-end (IDE) for R with integrated graphics and coding tools and is recommended (read: required) for this course. It is free and available for both Windows, Mac OS X and Linux. To download RStudio, visit RStudio's download page. If you don't know how up to date your version of RStudio is, please download a recent version and install it

  • R packages: Please be sure you have installed or updated the following packages:

    • remotes (not needed, if you have devtools already installed)
    • knitr
    • rmarkdown
    • bookdown
    • DT
    • tidyverse
    • leaflet
    • captioner

There are several ways to install a R package:

  • In the R console, type: install.packages("package-name") Note that R is case sensitive, and that the package name should be in quotes.

  • In RStudio, click on the "Packages" tab in the bottom right quadrant of the interface, click Install, type the package name and click Istall or click Tools => Install Packages, type the package name and click Install

  • In R for Windows clients, go to the Packages menu => Install package(s).

  • In R for MacOS X clients, go to the Package & Data menu and click on Package Installer => CRAN (binaries) => Get list. Click on the box “install dependencies” in order to automatically install other necessary libraries while installing your R libraries.

In our case, you could type at the R console:

workshop_pkg <- c("remotes", "knitr", "rmarkdown", "bookdown", "DT", "tidyverse", "leaflet", "captioner")

PDF rendering

If you want to generate PDF output from Markdown (we will mainly focus on html files), you will need to install LaTeX. For R Markdown users who have not installed LaTeX before, we recommend to follow the recommendations of [Xie et al, 2018] and that you install TinyTeX (

tinytex::install_tinytex()  # install TinyTeX
You can’t perform that action at this time.