6.1 Load packages and import data

In this tutorial we will make use of tidyverse and its suite of packages, as well as the skimr package. You’ll also use the palmerpenguins package that provides some penguin-related data to work with (see this website for more info). Lastly, you’ll use the knitr package for helping create nice tables. The latter package should have come installed with RStudio, so check the “packages” tab in the bottom-right pane of RStudio to see if it’s already installed. If it’s not, then install it following the instructions you saw earlier.

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

And we will use the following datasets in this tutorial:

  • the penguins dataset that is available as part of the palmerpenguins package
  • the tigerdeaths.csv file contains data associated with example 2.2A in the Whitlock and Schluter text
  • the birds.csv file contains counts of different categories of bird observed at a marsh habitat

Unless otherwise indicated, all CSV data files that we use in this course are stored at the same URL location, specifically: “https://raw.githubusercontent.com/ubco-biology/BIOL202/main/data/”. Thus, to import any CSV file you just need to copy that path, then append the appropriate file name to the end of the path. For example, the full path to access the birds.csv file would be “https://raw.githubusercontent.com/ubco-biology/BIOL202/main/data/birds.csv”. And a previous tutorial showed you how to import using the read_csv function.