R Markdown Template

Author
Affiliation

University of State

Published

September 1, 2025

R environment (renv)

Using renv while writing your tutorial will ensure that when a LingMethodsHub maintainer renders your tutorial, all of the necessary packages will be installed. Even if you’ve already been working on the tutorial, you can start using renv like so:

renv::init()
renv::snapshot()

This will create an renv/ directory, and an renv.lock file. You should add renv.lock to git.

Once you’ve run through all of the code for your tutorial again, just run renv::snapshot() one more time before you push your final commit.

Sample R Markdown Template

renv::use(lockfile = "renv.lock")
Warning: package 'ggplot2' was built under R version 4.5.2
Warning: package 'tibble' was built under R version 4.5.2
Warning: package 'tidyr' was built under R version 4.5.2
Warning: package 'purrr' was built under R version 4.5.2
library(showtext)
library(khroma)
font_add_google("Atkinson Hyperlegible", "atkinson")
showtext_auto()
palmerpenguins::penguins %>%
  ggplot(aes(flipper_length_mm, body_mass_g, color = species))+
    geom_point()+
    scale_color_bright()+
    theme_minimal()+
    theme(text = element_text(family = "atkinson"))
Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).

00_rmarkdown_template.pdf

Reuse

CC-BY-SA 4.0

Citation

BibTeX citation:
@online{doe2025,
  author = {Doe, Robin},
  title = {R {Markdown} {Template}},
  series = {Linguistics Methods Hub},
  date = {2025-09-01},
  url = {https://lingmethodshub.github.io/content/contributing/template/00_rmarkdown_template.html},
  langid = {en}
}
For attribution, please cite this work as:
Doe, Robin. 2025, September 1. R Markdown Template. Linguistics Methods Hub. (https://lingmethodshub.github.io/content/contributing/template/00_rmarkdown_template.html).