---
title: "data"
author: "Andy Field"
output: learnr::tutorial
---


### Data

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

* [alien_scents.csv](https://www.discovr.rocks/csv/alien_scents.csv)
* [sniffer_dogs.csv](https://www.discovr.rocks/csv/sniffer_dogs.csv)

Set up an `r rstudio()` project in the way that [I recommend in this video](https://youtu.be/mqT7c17tofE?si=R0aSApz66fGQKESl), 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:

```{r, eval=FALSE}
scents_tib <- here::here("data/alien_scents.csv") |>
   read_csv() |>
    mutate(
      entity = as_factor(entity) |> fct_relevel("Human", "Shapeshifter", "Alien"),
      scent_mask = as_factor(scent_mask) |> fct_relevel("None", "Human", "Fox")
      )
```

This code reads in the data and converts the variables `entity` and `scent_mask` to a factor (categorical variable). It also uses `fct_relevel` to set the order of the levels of the factor `entity` to be human, shapeshifter, and alien. Similarly, the order of the levels of the factor `scent_mask` are set as none, human, and fox.

For the sniffer dogs data use the code below (which, like the code above converts the variable `entity` to a factor):

```{r, eval=FALSE}
sniff_tib <- here::here("data/sniffer_dogs.csv") |>
   read_csv() |>
   mutate(
     entity = as_factor(entity)
     )
```