First up, we have to load our packages - no need to run the knitr line of code.
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
For Question 6: Finding FADs and LADs (first and last appearance datums)
We’re going to look at all genera within the genus of trilobites Phacops
Phacops<-read.csv("https://paleobiodb.org/data1.2/occs/list.csv?&base_name=Phacops&taxon_reso=lump_genus")
Now, we need to figure out the FAD and LAD of this genus. We’ve done this before, but I’ll show you again!
minage<-Phacops %>% summarise(min_age=min(min_ma))
maxage<-Phacops %>% summarise(max_age=max(max_ma))
PhacopsRange<-bind_cols(minage, maxage)
PhacopsRange
For question 7 of the lab - now we’re going to look at the diversity of a few different groups of Paleozoic intervebrate taxa. To do this, we will again download data from PBDB, but in a slightly different format.
Trilobites<-read.csv("https://paleobiodb.org/data1.2/occs/diversity.csv?base_name=trilobita&count=genera")
Once you get this data read in, click on it over on the right under ‘Global Environment’ to see the format.
For this lab, we’ll be focusing on the variable X_bt, which is the number of distinct taxa whose first occurrence falls before a time interval and whose last occurrence falls after the time interval, so that the range of occurrence crosses both boundaries. These are called “boundary crossers” and are a pretty reliable way to look at broad scale diversity patterns.
The time intervals here are shown as max_ma and min_ma. To make our plots more accurate, we’ll first want to make a new column called mean_ma that is the mean or average of max_ma and min_ma. We’ll use the mutate function again to do this.
Trilobites<-Trilobites %>% mutate(mean_ma=(min_ma+max_ma)/2)
Now we’ll make plots of mean_ma vs X_bt! Note we need to reverse the x axis scale to make time run from oldest to youngest left to right.
Trilobites %>% ggplot(aes(x=mean_ma, y=X_bt))+geom_line()+
scale_x_reverse()
Now make plots of mean_ma vs X_bt for the taxonomic groups listen in your lab!