data

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

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 read in the first datafile place this code in the first code chunk in your r quarto() document:

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

This code reads in the data, converts the variable dose to a factor (categorical variable) using as_factor() and sets the order of factor levels using fct_releval(). We can use very similar code

For the hangover data use this code:

cure_tib <- here::here("data/hangover.csv") |>
  read_csv() |>
  mutate(
    drink = as_factor(drink) |> fct_relevel("Water", "Lucozade", "Cola")
  )

This code reads in the data, converts the variable drink to a factor (categorical variable) and sets the order of the factor levels to match this tutorial.



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.