funrar: An R package to characterize functional rarity
Abstract
Emphasis has been put in recent ecological research on investigating phylogenetic, functional and taxonomic facets of biological diversity. While a flourishing number of indices have been proposed for assessing functional diversity, surprisingly few options are available to characterize functional rarity. Functional rarity can play a key role in community and ecosystem dynamics. We introduce here the funrar R package to quantify functional rarity based on species trait differences and species frequencies at local and regional scales. Because of the increasing availability of big datasets in macroecology and biogeography, we optimized funrar to work with large datasets of thousands of species and sites. We illustrate the use of the package to investigate the functional rarity of North and Central American mammals.
1 A TOOLKIT FOR THE DEFINITION AND QUANTIFICATION OF FUNCTIONAL RARITY
Biodiversity is multifaceted (Cardoso, Rigal, Borges, & Carvalho, 2014; Safi et al., 2011), and many indices have been proposed to summarize the taxonomic, phylogenetic and functional composition of ecological assemblages (Jarzyna & Jetz, 2016; Mazel et al., 2014). Such indices are used to investigate the influence of ecological, biogeographical and evolutionary processes at local and regional scales (McGill, Enquist, Weiher, & Westoby, 2006; Violle, Reich, Pacala, Enquist, & Kattge, 2014; Weiher et al., 2011). Many indices, such as community‐weighted moments, emphasize the contribution of abundant taxa because they are expected to make significant contributions to community and ecosystem functioning (Grime, 1998; Enquist et al. 2015), while the role of rare taxa is less addressed.
Rarity relates to biodiversity dynamics at multiple scales of geographical and niche space. Rabinowitz (1981) defined rarity based on the geographical range, habitat specificity and local population size of taxa, yielding seven forms of rarity. More recently, Violle et al. (2017) extended the scope of Rabinowitz's (1981) classification to further incorporate differences in functional traits among taxa, defining a new component—functional rarity. In this perspective, a species (or an individual) can be rare because of the uncommonness of its trait values and/or because of its low abundance at the local scale (Pavoine, Ollier, & Dufour, 2005). Indices of Functional Distinctiveness and Taxon Scarcity were proposed to quantify those two aspects at the local scale, respectively. A species can also be functionally rare at the regional scale because its functional characteristics are unique given the pool of species and/or because it is spatially restricted. Functional Uniqueness and Taxon Restrictedness respectively assess these two aspects at the regional scale. The four indices together provide a framework for characterizing functional rarity (Figures 1 and 2). Because functional rarity is expected to play a major role in ecosystem and biodiversity dynamics, the indices can be used to assess the influences of rare trait values on local and regional dynamics (Ricotta et al., 2016; Violle et al., 2017). We here introduce an R (R Core Team, 2016) package named funrar, to quantify functional rarity based on abundance or occurrence data and trait data. The funrar package, available through the Comprehensive R Archive Network (CRAN), computes Functional Distinctiveness, Functional Uniqueness, Taxon Scarcity and Taxon Restrictedness and is optimized to handle high‐dimensional data (large number of sites and/or large number of species) using sparse matrix algebra. We illustrate the application of this package for examining functional rarity using data on North and Central American mammals (Lawing, Eronen, Blois, Graham, & Polly, 2017) (the code to run the analyses is available on Github at https://github.com/Rekyt/mamm_funrar archived on Zenodo https://doi.org/10.5281/zenodo.375605).


2 QUANTIFYING FUNCTIONAL RARITY USING funrar FUNCTIONS
Users must provide a site‐by‐species matrix of community composition across sites, with either the presence–absence or relative abundances of species. funrar functions can handle site‐by‐species data in any of three formats: site‐species matrix (with sites as rows and species as columns, see Figure 1 for available functions); “tidy” format (Wickham, 2014), with each row coding the observation of a single species at a given site (the function has a _stack suffix); or as a single community (the function has a _com suffix). Abundance or occurrence information can be based on population or community census and possibly account for imperfect detection (Dénes, Silveira, & Beissinger, 2015; Iknayan, Tingley, Furnas, & Beissinger, 2014; Jarzyna & Jetz, 2016).
Functional distances or dissimilarities are used in the calculation of functional rarity indices (Violle et al., 2017). In funrar, a functional distance matrix can be calculated from a table of one or several traits measured for each taxa with compute_dist_matrix(). Different kinds of traits (continuous, categorical, ordinal) can be scaled or weighted in various ways when combined (Pavoine, Vallet, Dufour, Gachet, & Daniel, 2009). By default compute_dist_matrix() computes the unweighted Gower's (1971) distance because it covers classes of trait data and makes them comparable, but the user can also specify euclidean or manhattan distances. It is possible to scale traits using the center and scale arguments when traits are continuous.
(1)
(2)Di is the mean dissimilarity of a focal species as defined in Ricotta et al. (2016), that is the mean pairwise functional dissimilarity from a focal species to all the others. Functional Distinctiveness then relates to functional redundancy in an assemblage: the larger the index value, the more distant (less redundant) a species (or an individual) is to the average functional position of the assemblage in the functional space, that is the centroid.
(3)As emphasized by Violle et al. (2017), a species can be functionally distinct (high Di) in a given community but not functionally unique in an entire region (small Ui). In this regard, Distinctiveness and Uniqueness are used to uncover scale‐dependent biodiversity dynamics: by default, funrar provides the former at local site level while the latter is computed at regional scale (whole site‐species matrix). At local scale, community dynamics involve all coexisting species and their relative abundance is expected to convey the signature of assembly processes. Between‐species dissimilarities and Functional Distinctiveness are thus relevant to assess the role of functional originality in community assembly. At regional scale, Functional Uniqueness can represent how taxa depart from a regional pool due to specific biogeographical and evolutionary legacies and should then be estimated based on the whole site‐species matrix. Nevertheless, each index can be computed at both scales to grasp the different aspects of functional rarity (examples in the help of distinctiveness() and uniqueness()).
Because Distinctiveness and Uniqueness are computed using multiple traits, it can be difficult to disentangle if a species exhibits high values because of a single extreme trait value or because it has several rare trait values. The uniqueness_dimensions() and distinctiveness_dimensions() functions respectively compute Uniqueness and Distinctiveness values from the traits taken one by one as well as altogether. The former outputs a table with the value of Uniqueness for each trait and for all the traits considered together, while the latter outputs a list of site‐species matrices of computed Distinctiveness values, one matrix per trait and one for all the traits considered together.
(4)
(5)Because of the increasing availability of large‐scale and intensive datasets in ecology (Hampton et al., 2013), a site‐species matrix can contain thousands of sites and thousands of species. However, as not all species are everywhere, site‐species matrices are usually filled with many zeroes. Sparse matrices allow storing only the position of non‐zero cells, saving memory. funrar performs sparse matrix calculations using the Matrix package for quicker and memory‐efficient computations (Bates & Maechler, 2016). For more details, see the vignette included in the package.
3 FUNCTIONAL RARITY OF NORTH AND CENTRAL AMERICAN MAMMALS
We used funrar to analyse a subset of the dataset of North and Central American Mammals from Lawing et al. (2017), Lawing, Eronen, Blois, Graham, and Polly (2016). We selected 265 species out of 558 for which trait information was available. We used six traits relevant to mammal ecology (body mass, litter size, diet breadth, trophic level, habitat breadth and terrestriality, see Jones et al. (2009) for detailed trait explanation). The dataset comprises the presence–absence information for the 265 species across 9699 50 km x 50 km cells. We asked whether there are “hotspots” of Functional Uniqueness in North America and Central America for the six aforementioned traits; whether species that are functionally unique are geographically restricted; what the most functionally distinct and unique mammal species in the dataset are; and whether there are more functionally rare species in temperate, tropical or boreal areas.
For each species, we calculated Functional Uniqueness and Taxon Restrictedness indices and averaged them across species by grid cell. Because those two indices are regional‐level indices, each species had a unique value, and the variation in averaged indices among grid cells thus reflects change in species composition. We produced maps of the average values for indices in North and Central America (Figure 3). We also computed functional rarity—the average of Functional Uniqueness and Taxon Restrictedness—where each is scaled between zero and one. The most functionally unique cells were in Cuba (Figure 3a), meaning that they hosted, on average, species that are quite functionally unique compared to the species pool of North and Central America. This pattern may be due to the tropical climate present in Cuba, which is less present across the rest of the dataset. We also identified a latitudinal gradient in Taxon Restrictedness (Figure 3b): sites at low latitude hosted more restricted species on average than sites in temperate and boreal regions, a pattern that complies with Rapoport's rule (Gaston, Blackburn, & Spicer, 1998; Rapoport, 1982). Altogether, combining the two facets into a single index highlighted Cuba as a hotspot of functional rarity (Figure 3c).

At the species level, Functional Uniqueness and Taxon Restrictedness were not correlated (Spearman's rho = −.06, p = .323) (Figure 4). Most species were geographically restricted (with many values around 1, meaning that they were present in a few grid cells only) but functionally redundant, that is with low values of Functional Uniqueness. Conversely, almost no species were both geographically widespread and functionally unique, apart from Castor canadensis (red dot in the bottom right corner of Figure 4), which occupies a very specific habitat (fossorial and ground dwelling) and is distributed continent‐wide. Functional Distinctiveness and Functional Uniqueness were correlated (Spearman's rho = .37, p < .001), indicating that species that were locally functionally distinct tended to be regionally functionally unique. Even though local functional rarity and regional functional rarity were quite correlated, the weak correlation implies that rarity should be estimated both at the local and regional scale because it contrasts different types of rarity.

In summary, North and Central American mammals display a biogeographical gradient of functional rarity, such as species at low latitude show higher Functional Uniqueness and Taxon Restrictedness (Figure 3), even though most mammal species have low Functional Uniqueness and high Taxon Restrictedness (top left corner in Figure 4). The absence of correlation of Functional Uniqueness and Taxon Restrictedness shows that these components of functional rarity provide complementary information. Therefore, both components should be considered when mapping rarity and defining priority targets in conservation programs.
4 CONCLUSION
Conservation biology has historically focused on the protection of rare species in terms of taxon occurrences and abundances (Prendergast, Quinn, Lawton, Eversham, & Gibbons, 1993). Although it can be decomposed in local, regional and habitat dimensions (Rabinowitz, 1981), this approach has emphasized taxonomic rarity and neglected the originality of functional attributes. Recently though, assessing species originality in terms of phylogenetic rarity (Cadotte & Jonathan Davies, 2010; Isaac, Turvey, Collen, Waterman, & Baillie, 2007; Rosauer, Laffan, Crisp, Donnellan, & Cook, 2009) and functional rarity (Mouillot et al., 2013; Umaña, Zhang, Cao, Lin, & Swenson, 2015; Violle et al., 2017) has gained momentum. It underlines the need to characterize patterns of rarity through the ecological and evolutionary attributes that influence biodiversity dynamics at multiple scales. Uncorrelated Functional Uniqueness and Restrictedness in North and Central American Mammals suggest that the functional component of rarity should be considered for a more comprehensive assessment of biodiversity dynamics and a better design of conservation strategies. Such integrated view on rarity echoes Winter, Devictor, and Schweiger (2013) suggestion to “[include] other facets of diversity” for conservation. The funrar package contributes to the growing toolbox available for researchers to study and quantify the various dimensions of biodiversity and rarity. Adding the functional rarity string would strengthen the bow of diversity and rarity facets.
ACKNOWLEDGEMENTS
This research is supported by the French Foundation for Research on Biodiversity (FRB; www.fondationbiodiversite.fr) in the context of the CESAB project “Causes and consequences of functional rarity from local to global scales” (FREE). PD and CV were supported by the European Research Council (ERC) Starting Grant Project “Ecophysiological and biophysical constraints on domestication of crop plants” (Grant ERC‐StG‐2014‐639706‐CONSTRAINTS). CMT acknowledges the European Commission for the Marie Curie IIF (H2020‐MSCA‐IF‐2014‐657951).
DATA ACCESSIBILITY
funrar stable version is available on CRAN (via install.package(“funrar”) or https://cran.r-project.org/package=funrar) and the development version is on Github at https://github.com/Rekyt/funrar. The code necessary to reproduce the analyses is on Github at https://github.com/Rekyt/mamm_funrar, an archived version is accessible on Zenodo https://doi.org/10.5281/zenodo.375605
REFERENCES
BIOSKETCH
Matthias Grenié is a PhD student at the University of Montpellier and at the Centre d’Écologie Fonctionnelle et Évolutive in Montpellier. He studies the common determinants of diversity across different taxonomic groups and has broad interests in biogeography, community ecology and functional ecology.
Author contributions: M.G. and P.D. designed the package; C.T. reviewed it; M.G. wrote the first draft of the manuscript; and all the authors edited and commented it.
Citing Literature
Number of times cited according to CrossRef: 17
- Robert S.C. Cooke, Felix Eigenbrod, Amanda E. Bates, Ecological distinctiveness of birds and mammals at the global scale, Global Ecology and Conservation, 10.1016/j.gecco.2020.e00970, (e00970), (2020).
- Pablo A. Menéndez-Guerrero, T. Jonathan Davies, David M. Green, Extinctions of Threatened Frogs may Impact Ecosystems in a Global Hotspot of Anuran Diversity, Herpetologica, 10.1655/0018-0831-76.2.121, 76, 2, (121), (2020).
- Maísa A. Matuoka, Maíra Benchimol, José Carlos Morante‐Filho, Tropical forest loss drives divergent patterns in functional diversity of forest and non‐forest birds, Biotropica, 10.1111/btp.12795, 52, 4, (738-748), (2020).
- Nicolas Loiseau, Nicolas Mouquet, Nicolas Casajus, Matthias Grenié, Maya Guéguen, Brian Maitner, David Mouillot, Annette Ostling, Julien Renaud, Caroline Tucker, Laure Velez, Wilfried Thuiller, Cyrille Violle, Global distribution and conservation status of ecologically rare mammal and bird species, Nature Communications, 10.1038/s41467-020-18779-w, 11, 1, (2020).
- Rilquer Mascarenhas, Flávia M. Ruziska, Eduardo Freitas Moreira, Amanda B. Campos, Miguel Loiola, Kaike Reis, Amaro E. Trindade-Silva, Felipe A. S. Barbosa, Lucas Salles, Rafael Menezes, Rafael Veiga, Felipe H. Coutinho, Bas E. Dutilh, Paulo R. Guimarães, Ana Paula A. Assis, Anderson Ara, José G. V. Miranda, Roberto F. S. Andrade, Bruno Vilela, Pedro Milet Meirelles, Integrating Computational Methods to Investigate the Macroecology of Microbiomes, Frontiers in Genetics, 10.3389/fgene.2019.01344, 10, (2020).
- Naraiana Loureiro Benone, Bruno Eleres Soares, Cleonice Maria Cardoso Lobato, Lidia Brasil Seabra, David Bauman, Luciano Fogaça de Assis Montag, How modified landscapes filter rare species and modulate the regional pool of ecological traits?, Hydrobiologia, 10.1007/s10750-020-04405-9, (2020).
- Nicholas A. C. Marino, Régis Céréghino, Benjamin Gilbert, Jana S. Petermann, Diane S. Srivastava, Paula M. Omena, Fabiola Ospina Bautista, Laura Melissa Guzman, Gustavo Q. Romero, M. Kurtis Trzcinski, Ignacio M. Barberis, Bruno Corbara, Vanderlei J. Debastiani, Olivier Dézerald, Pavel Kratina, Céline Leroy, Arthur Andrew M. MacDonald, Guillermo Montero, Valério D. Pillar, Barbara A. Richardson, Michael J. Richardson, Stanislas Talaga, Ana Z. Gonçalves, Gustavo C. O. Piccoli, Merlijn Jocqué, Vinicius F. Farjalla, Species niches, not traits, determine abundance and occupancy patterns: A multi‐site synthesis, Global Ecology and Biogeography, 10.1111/geb.13029, 29, 2, (295-308), (2019).
- Tiago S. Vasconcelos, Fernando R. da Silva, Tiago G. dos Santos, Vitor H. M. Prado, Diogo B. Provete, Tiago S. Vasconcelos, Fernando R. da Silva, Tiago G. dos Santos, Vitor H. M. Prado, Diogo B. Provete, Geographical Patterns of Functional Diversity of South American Anurans, Biogeographic Patterns of South American Anurans, 10.1007/978-3-030-26296-9, (107-123), (2019).
- Isadora Correia, Erivelton Rosário do Nascimento, Sidney F. Gouveia, Effects of climate and land-use gradients on avian phylogenetic and functional diversity in a tropical dry forest, Journal of Arid Environments, 10.1016/j.jaridenv.2019.104024, (104024), (2019).
- Karl A. Lamothe, Karen M. Alofs, Cindy Chu, Evaluating functional diversity conservation for freshwater fishes resulting from terrestrial protected areas, Freshwater Biology, 10.1111/fwb.13395, 64, 11, (2057-2070), (2019).
- Darwin S. Sodhi, Stuart W. Livingstone, Marta Carboni, Marc W. Cadotte, Plant invasion alters trait composition and diversity across habitats, Ecology and Evolution, 10.1002/ece3.5130, 9, 11, (6199-6210), (2019).
- Marc W. Cadotte, Caroline M. Tucker, Difficult decisions: Strategies for conservation prioritization when taxonomic, phylogenetic and functional diversity are not spatially congruent, Biological Conservation, 10.1016/j.biocon.2018.06.014, 225, (128-133), (2018).
- Matthias Grenié, David Mouillot, Sébastien Villéger, Pierre Denelle, Caroline M. Tucker, François Munoz, Cyrille Violle, Functional rarity of coral reef fishes at the global scale: Hotspots and challenges for conservation, Biological Conservation, 10.1016/j.biocon.2018.08.011, 226, (288-299), (2018).
- Sun W. Kim, Simon P. Blomberg, John M. Pandolfi, Transcending data gaps: a framework to reduce inferential errors in ecological analyses, Ecology Letters, 10.1111/ele.13089, 21, 8, (1200-1210), (2018).
- Karl A. Lamothe, Karen M. Alofs, Donald A. Jackson, Keith M. Somers, Functional diversity and redundancy of freshwater fish communities across biogeographic and environmental gradients, Diversity and Distributions, 10.1111/ddi.12812, 24, 11, (1612-1626), (2018).
- Susy Echeverría-Londoño, Brian J. Enquist, Danilo M. Neves, Cyrille Violle, Brad Boyle, Nathan J. B. Kraft, Brian S. Maitner, Brian McGill, Robert K. Peet, Brody Sandel, Stephen A. Smith, Jens-Christian Svenning, Susan K. Wiser, Andrew J. Kerkhoff, Plant Functional Diversity and the Biogeography of Biomes in North and South America, Frontiers in Ecology and Evolution, 10.3389/fevo.2018.00219, 6, (2018).
- Cyrille Violle, Wilfried Thuiller, Nicolas Mouquet, François Munoz, Nathan J.B. Kraft, Marc W. Cadotte, Stuart W. Livingstone, Matthias Grenie, David Mouillot, A Common Toolbox to Understand, Monitor or Manage Rarity? A Response to Carmona et al., Trends in Ecology & Evolution, 10.1016/j.tree.2017.10.001, 32, 12, (891-893), (2017).




