This exercise will demonstrate how to create a list of formatted citationsfor most of the publications included in the COMPADRE and COMADRE databases. This example relies on the package 'rcrossref' and uses the Digitial Object Identifiers (DOIs) included in the metadata.

Video tutorial

A video tutorial has been created to accompany this page and demonstrate these excercises.

Check it out here on the COM(P)ADRE Learn YouTube channel!

Walkthrough and R code

The R code for these exercises can be downloaded as an R file or PDF in addition to being displayed on this page.

Download as R file
Download as PDF


This exercise requires the Rcompadre and rcrossref packages.


Obtaining references

Download and load either the COMPADRE or COMADRE database from the website. In this example, we use the COMADRE database.



You may also download the COMPADRE or COMADRE objects using the Rcompadre package:

compadre <- cdb_fetch("compadre")
comadre <- cdb_fetch("comadre") 

Next, we’ll convert the database to an S4 CompadreDB object to work with Rcompadre package. This step only applies to downloads from the website. Downloads using the ‘cbd_fetch’ function are already in S4 format.

comadre <- as_cdb(comadre) 

Let’s start by examine some data for the family Canidae (wolves, foxes, and similar animals) in the COMADRE database. We’ll then create a subset of the database containing only data for animals in Canidae.

comadre$MatrixID[which(comadre$Family == "Canidae")]
comadre_subset <- comadre[which(comadre$Family == "Canidae")] 

COMPADRE and COMADRE have several helpful fields in the metadata for finding references associated with matrix population models. Let’s examine some of them.


The rcrossref package can create a references list based on our data subset. Let’s take a look.

rcrossref::cr_cn(unique(comadre_subset$DOI_ISBN), format = "text", style = "apa") 

Using the ‘unique’ argument above prevents duplicates in our returned reference list.

You can use this function to generate reference lists for the entire database, a subset, or your own list of DOIs.