1. A Leslie matrix example (small groups)

A population of fish we’re interested in has four life stages: eggs (E), fry (F), juvenile (J), breeding adult (A). You are given the following:

  • Each breeding adult will produce, on average, 600 eggs
  • 25% of eggs will survive to become fry
  • 10% of fry will survive to become juveniles
  • 40% of juveniles will survive to become adults
  • Adult survival rate year to year is 80%
  1. With your group, draw the Leslie matrix model for this population structure.

  2. With your group, given an initial population (Year 0) that has 0 eggs, 40,000 fry, 600 juveniles, and 450 adults, by hand project the population structure (i.e. the count in each life stage) in Year 1.

2. Fork & clone a repo to check your Leslie matrix, and make projections

  • Fork and clone this repo, which contains the Leslie matrix for the example above.

    • Go to the link above. Press Fork in upper right, then Create Fork.
    • Once in your fork, press the green ‘Code’ button
    • Copy the URL to your clipboard
    • Back in RStudio, create a new project (with version control)
    • Where prompted, paste the URL & choose where you’ll save your directory
    • Create project
    • Open the .Rmd to explore & run Leslie Matrix code
  • Explore the code and outputs. Does the Year 1 population projection align with what you calculated?

  • Add code to the .Rmd to expand the projections to years 4, 5, and 6 (it current projects through year 3)

  • Using the command line: Save, stage, commit, then push your changes.

3. Data exploration & summarizing in R

  • Create a new Project
  • Add a new Quarto document in your project, save as r-exploring
  • Set up your local and remote git repo by running usethis::use_git() and then usethis::use_github()
  • Attach the tidyverse, skimr, and GGally packages in the setup code chunk
  • Run View(diamonds) in the Console to look at the built-in diamonds dataset in R
  • Explore the dataset using the functions names(), dim(), summary(), head(), tail(), and skimr::skim()
  • Create a pairs plot using ggpairs()
  • Create a basic ggplot scatterplot of diamond price (price) as a function of size (carat)
  • Create a histogram showing the distribution of values in the carat column (recall: a histogram only requires a single variable, e.g. aes(x = carat))
  • Save, stage, commit, pull, then push your changes back to your repo in RStudio using the GUI interface (buttons)
  • Create a boxplot (see: geom_box) of diamond clarity (on the x-axis) and price (y-axis).
  • In the command line, stage, commit, & push changes

End