8.1 Load packages and import data

Let’s load some familiar packages first:

library(tidyverse)
library(palmerpenguins)
library(knitr)
library(skimr)

We also need the janitor package, the ggmosaic package, and the ggExtra packages, and these are likely to be new to you. Check whether these packages are installed under the “packages” tab in the bottom-right panel in RStudio. If they are not yet installed, then install them. Only install them once on your computer!

Load the packages:

library(janitor)
library(ggmosaic)
library(ggExtra)

Import Data

We’ll again make use of the penguins dataset, which gets loaded as a “tibble” object with the palmerpenguins package.

Import the locusts.csv data, which are described in the Whitlock & Schluter text, Figure 2.1-2. We’ll create a tibble called locust.

locust <- read_csv("https://raw.githubusercontent.com/ubco-biology/BIOL202/main/data/locust.csv")
## Rows: 30 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): serotoninLevel, treatmentTime
## 
## ℹ 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.

Import the bird.malaria.csv data, which are described in the Whitlock & Schluter text, Example 2.3A (p. 40). We’ll create a tibble called bird.malaria.

bird.malaria<- read_csv("https://raw.githubusercontent.com/ubco-biology/BIOL202/main/data/bird_malaria.csv")
## Rows: 65 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): treatment, response
## dbl (1): bird
## 
## ℹ 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.
  1. Get an overview of the locust and bird.malaria tibbles.