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.2.0 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.2 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── 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()
In the lab, I ask you about the P-T boundary - but we can’t really tell where that is in this plot, or much else about where we are in time. Fortunately, there’s a package for that! Let’s keep leveling up here and add a geological timescale to our plots. To do this, we need to install and load a new package.
library(deeptime)
Now, we’ll add code using this package to plot the geological timescale on our x-axis. As you can see I’ve also added a theme to make the plot look cleaner (I’m personally not a fan of that grey default background! We also want to have a title for our plot so we know what we’ve just made.
Trilobites %>% ggplot(aes(x=mean_ma, y=X_bt))+geom_line()+
scale_x_reverse()+
theme_bw()+
coord_geo(
pos = "bottom",
dat = "periods"
)+
ggtitle("Trilobite boundary crosser diversity")
Now make plots of mean_ma vs X_bt for the taxonomic groups listed in your lab!