# Worksheet 4

Published

September 19, 2023

Questions are below. My solutions are below all the question parts for a question; scroll down if you get stuck. There is extra discussion below that for some of the questions; you might find that interesting to read, maybe after tutorial.

For these worksheets, you will learn the most by spending a few minutes thinking about how you would answer each question before you look at my solution. There are no grades attached to these worksheets, so feel free to guess: it makes no difference at all how wrong your initial guess is!

# 1 Observing seabirds

Each year, bird experts associated with the Kodiak National Wildlife Refuge in Alaska count the number of seabirds of different types on the water in each of four different bays in the area. This is done by drawing (on a map) a number of straight-line “transects”, then driving a boat along each transect and counting the number and type of birds within a certain distance of the boat.

Variables of interest are:

• the Year of observation
• the Transect number
• Temp: the temperature
• ObservCond: visibility, from Average up to Ideal
• Bay the name of the bay
• bird: an abbreviation for the species of bird observed
• count: how many of that type of bird were observed (in that year, bay, transect).

The data are in http://ritsokiguess.site/datafiles/seabird_long.csv.

1. Read in and display some of the data.

2. A data set containing the full bird names and their principal diet is in http://ritsokiguess.site/datafiles/bird_names.csv. Read in and display some of this data set.

3. It is awkward to read the bird abbreviations in the first dataframe. Create and save a new dataframe that has the full bird names as well as the number that were observed and all the other information.

4. Which three species of bird were seen the most often altogether?

5. Make a graph that shows the trend in total counts of each bird species over time. Think about what would make the most appealing graph to understand the time trends.

## My solutions

Each year, bird experts associated with the Kodiak National Wildlife Refuge in Alaska count the number of seabirds of different types on the water in each of four different bays in the area. This is done by drawing (on a map) a number of straight-line “transects”, then driving a boat along each transect and counting the number and type of birds within a certain distance of the boat.

Variables of interest are:

• the Year of observation
• the Transect number
• Temp: the temperature
• ObservCond: visibility, from Average up to Ideal
• Bay the name of the bay
• bird: an abbreviation for the species of bird observed
• count: how many of that type of bird were observed (in that year, bay, transect).

The data are in http://ritsokiguess.site/datafiles/seabird_long.csv.

## (a) Read in and display some of the data.

my_url <- "http://ritsokiguess.site/datafiles/seabird_long.csv"
seabird <- read_csv(my_url)
Rows: 56895 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): ObservCond, Bay, ObservCondFactor3, bird
dbl (5): Year, Site, Transect, Temp, count

ℹ 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.
seabird