This vignette is a basic guide to begin exploring the Portal data. We load in the data (making sure that we’re using the most recent copy from GitHub), and then explore the rodent abundances over time, with a comparison between the “control” and “kangaroo rat exclosure” treatments.

Package Setup

First we load several packages:

  • tidyverse contains several packages for data manipulation and plotting.

  • cowplot contains a nicer default theme for ggplot.

  • portalr is this package, which contains functions to read in the Portal data and do some basic processing.


Retrieving the Data

Note that this package does not contain the actual Portal data, which resides online in a GitHub repository.

First, we try to load the data. If there isn’t a Portal folder, than load_rodent_data will fall back to downloading the data, as well.

check whether we already have the data. If we don’t have the data, or if the version we have isn’t the most recent, we use the download_observations function to download the latest copy of the data.

The load_rodent_data function reads in several tables related to the rodent abundances. We won’t necessarily use all of these tables, but loading this now gives us access later.

Rodent Abundances

The first table that we loaded (data_tables$rodent_data) is a record of whatever was found in the traps, mostly rodents, but also a few other taxa. If we just wanted to get the rodent abundance data, we could use the abundance function, which has default arguments to filter out the non-rodents.

Let’s convert the data to long format for easier facetting. Also, we want the scientific names instead of the two-letter species codes, so let’s do that matching, too:

Next Steps

Our next steps would likely be to dig deeper into the rodent abundances for different treatments, but first we want to know what the different treatments look like, so let’s revisit the abundances later.

Plot Treatments

A description of the experimental design and treatments can be found in this Readme file in the PortalDate repo.

For now, we are just going to use the Portal_plots table file to look at how the treatments for individual plots have changed over time. Note that this file is already loaded in as the plots_table from the loadData function we ran previously.

We want a proper date variable as well as converting plot into a factor:

Identifying control plots

The treatments for the plots have changed over time: in some cases, this was due to initial ramping up of the experimental protocol, in others, exclusions of Dipodomys spectabilis were started and then converted back later because the species went locally extinct (e.g. plots 1, 5, 9, 24).

Abundances over control plots

We are now ready to plot abundances just over the control plots and the time span in 1977-07-01 to 2015-03-01. We do this by retrieving the abundance data by plot, and then filtering accordingly:

Monthly abundance of rodents (control plots)

Monthly abundance of rodents (control plots)

Abundances over rodent exclosures

We can do the same with the “exclosure” condition. First, which plots:

Then, the datespan:

Finally, the figure:

Monthly abundance of rodents (exclosure plots)

Monthly abundance of rodents (exclosure plots)

Since these data have the same number of plots as the previous figure, we can directly compare abundances. Note the decreased numbers for kangaroo rats (Dipodomys spp.) and increased numbers for some other taxa.

Comparison Figure

Let’s merge the two datasets and produce a combined plot:

Monthly abundance of rodents (control vs. exclosure plots)

Monthly abundance of rodents (control vs. exclosure plots)

As expected, there are substantially lower counts of kangaroo rats (Dipodomys spp.) in the “exclosure” plots. We also observe very similar abundances for some species, but increases in others (e.g. “Chaetodipus baileyi”, “Perognathus flavus”, “Reithrodontomys megalotis”)