data

This tutorial follows on from the previous one where we created the variables in this table:

tibble::tribble(
  ~name, ~birth_date, ~death_date, ~instrument, ~current_member, ~songs_written, ~net_worth, ~albums,
  "Lars Ulrich", "1963-12-26", NA, "Drums", TRUE, 123, 350, 11,
  "James Hetfield", "1963-08-03", NA, "Guitar", TRUE, 124, 300, 11, 
  "Kirk Hammett", "1962-11-18", NA, "Guitar", TRUE, 60, 200, 11, 
  "Rob Trujillo", "1964-10-23", NA, "Bass",  TRUE, 19, 40, 3, 
  "Jason Newsted", "1963-03-04", NA, "Bass", FALSE, 3, 60, 4, 
  "Cliff Burton", "1962-02-10", "1986-09-27", "Bass", FALSE, 11, 1, 3,
  "Dave Mustaine", "1961-09-13", NA, "Guitar", FALSE, 6, 14, 0
  ) |> 
  knitr::kable(caption = "Some data about the rock band Metallica", format = "html") |> 
  kableExtra::kable_styling(bootstrap_options = "striped")

These variables are pre-created in this tutorial, but when working outside of it, either continue your previous r quarto() document (where the variables are created) or if working in a fresh r quarto() document paste this code in a code chunk to recreate them:

name <- c("Lars Ulrich", "James Hetfield", "Kirk Hammett", "Rob Trujillo", "Jason Newsted", "Cliff Burton", "Dave Mustaine")
songs_written <-  c(123, 124, 60, 19, 3, 11, 6)
net_worth <- c(350, 300, 200, 40, 60, 1, 14)
birth_date <- c("1963-12-26", "1963-08-03", "1962-11-18", "1964-10-23", "1963-03-04", "1962-02-10", "1961-09-13") |> ymd()
death_date <- c(NA, NA, NA, NA, NA, "1986-09-27", NA) |> 
  ymd()
current_member <- c(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE)
instrument <- c("Drums", "Guitar", "Guitar", "Bass", "Bass", "Bass", "Guitar") |>
  forcats::as_factor() |>
  fct_relevel("Guitar", "Bass", "Drums")


Try the discovr package in your browser

Any scripts or data that you put into this service are public.

discovr documentation built on Feb. 5, 2026, 5:07 p.m.