11.1 Load packages and import data
Load the tidyverse
, skimr
, naniar
, knitr
, and janitor
packages:
We will also need a new package called binom
, so install that package using the procedure you previously learned, then load it:
Import the damselfly.csv
data set we used in the preceding tutorial, and also the birds.csv
dataset we used in an earlier tutorial.
damselfly <- read_csv("https://raw.githubusercontent.com/ubco-biology/BIOL202/main/data/damselfly.csv")
## Rows: 20 Columns: 1
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): direction
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 86 Columns: 1
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): type
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Recall what the damselfly dataset looks like:
## # A tibble: 20 × 1
## direction
## <chr>
## 1 clockwise
## 2 counter_clockwise
## 3 counter_clockwise
## 4 clockwise
## 5 counter_clockwise
## 6 counter_clockwise
## 7 counter_clockwise
## 8 counter_clockwise
## 9 counter_clockwise
## 10 counter_clockwise
## 11 counter_clockwise
## 12 clockwise
## 13 counter_clockwise
## 14 counter_clockwise
## 15 counter_clockwise
## 16 counter_clockwise
## 17 counter_clockwise
## 18 counter_clockwise
## 19 counter_clockwise
## 20 counter_clockwise
The data show the predominant direction (either clockwise or counter-clockwise) of 20 circular battles between male damseflies.
And remind yourself what the birds dataset looks like:
## # A tibble: 86 × 1
## type
## <chr>
## 1 Waterfowl
## 2 Predatory
## 3 Predatory
## 4 Waterfowl
## 5 Shorebird
## 6 Waterfowl
## 7 Waterfowl
## 8 Songbird
## 9 Predatory
## 10 Waterfowl
## # ℹ 76 more rows
These data describe the category of bird (variable “type” that has 4 different categories) for a random sample of 86 birds sampled at a marsh habitat.