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}. Place this code in the first code chunk in your r quarto() document:

goggles_tib <- here::here("data/goggles.csv") |>
  read_csv() |>
  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).

For the xbox data use this code (in which I have been explicit in setting certain categories as the first level of the factor using fct_relevel()):

xbox_tib <- here::here("data/xbox.csv") |>
  read_csv() |>
  mutate(
    game = as_factor(game) |> fct_relevel("Static"),
    console = as_factor(console) |> fct_relevel("Xbox One")
  )


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.