data

To work outside of this tutorial you need to download the following data file:

Set up an r rstudio() project in the way that I recommend in this video, and save the data files to the folder within your project called [data]{.alt}. To load the first datasetpPlace this code in the first code chunk in your r quarto() document:

album_tib <- here::here("data/album_sales.csv") |> read_csv()

To load the invisibility data use this code:

cloak_tib <- here::here("data/invisibility.csv") |> 
  read_csv() |> 
  mutate(
    cloak = as_factor(cloak)
  )

To load the beer goggles data use this code:

goggles_tib <- here::here("data/goggles.csv") |>
  readr::read_csv() |>
  dplyr::mutate(
    facetype = as_factor(facetype),
    alcohol = as_factor(alcohol)
  )

This code reads in the data and converts the variables alcohol and facetype to factors (categorical variable).

To load the puppy therapy data use this code:

puppy_tib <- here::here("data/puppies.csv") |> 
  read_csv() |> 
  dplyr::mutate(
    dose = as_factor(dose) |> fct_relevel("No puppies", "15 mins", "30 mins")
  )

To load the puppy therapy data that also measures pre-treatment happiness use this code:

puptreat_tib <- here::here("data/puppy_rct.csv") |>
  read_csv() |>
  mutate(
    dose = as_factor(dose) |> fct_relevel("No puppies", "15 mins", "30 mins")
  )

For both puppy therapy datasets, the code reads in the data and converts the variable dose to a factor (categorical variable) and manually sets the order of the levels to be "No puppies", "15 mins", and "30 mins".



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.