knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

canaper

DOI R-CMD-check Project Status: active. Codecov test coverage ropensci review runiverse CRAN status

#' @srrstats {G1.1} documents novelty

The goal of canaper is to enable categorical analysis of neo- and paleo-endemism (CANAPE) in R.

Installation

The stable version can be installed from CRAN:

install.packages("canaper")

The development version can be installed from r-universe or github:

# r-universe
options(repos = c(
  ropensci = "https://ropensci.r-universe.dev/", 
  CRAN = "https://cran.rstudio.com/"
))
install.packages("canaper", dep = TRUE)

# OR

# github (requires `remotes` or `devtools`)
remotes::install_github("ropensci/canaper")

Example usage

These examples use the dataset from Phylocom. The dataset includes a community (site x species) matrix and a phylogenetic tree.

library(canaper)

data(phylocom)

# Example community matrix including 4 "clumped" communities,
# one "even" community, and one "random" community
phylocom$comm

# Example phylogeny
phylocom$phy

The main "workhorse" function of canaper is cpr_rand_test(), which conducts a randomization test to determine if observed values of phylogenetic diversity (PD) and phylogenetic endemism (PE) are significantly different from random. It also calculates the same values on an alternative phylogeny where all branch lengths have been set equal (alternative PD, alternative PE) as well as the ratio of the original value to the alternative value (relative PD, relative PE).

set.seed(071421)
rand_test_results <- cpr_rand_test(
  phylocom$comm, phylocom$phy,
  null_model = "swap"
)

cpr_rand_test produces a lot of columns (nine per metric), so let's just look at a subset of them:

rand_test_results[, 1:9]

This is a summary of the columns:

The next step in CANAPE is to classify endemism types according to the significance of PE, alternative PE, and relative PE. This adds a column called endem_type.

canape_results <- cpr_classify_endem(rand_test_results)

canape_results[, "endem_type", drop = FALSE]

This data set is very small, so it doesn't include all possible endemism types. In total, they include:

For a more complete example, please see the vignette

Comparsion with other software

Several other R packages are available to calculate diversity metrics for ecological communities. The non-exhaustive summary below focuses on alpha diversity metrics in comparison with canaper, and is not a comprehensive description of each package.

Other information

Poster at Botany 2021

Citing this package

If you use this package, please cite it! Here is an example:

The example DOI above is for the overall package.

Here is the latest DOI, which you should use if you are using the latest version of the package:

DOI

You can find DOIs for older versions by viewing the "Releases" menu on the right.

Papers citing canaper

Contributing and code of conduct

Contributions to canaper are welcome! For more information, please see CONTRIBUTING.md

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Note to developers

roxyglobals is used to maintain R/globals.R, but is not available on CRAN. You will need to install this package from github and use the @autoglobal or @global roxygen tags to develop functions with globals.

Licenses

References

Mishler, B., Knerr, N., González-Orozco, C. et al. Phylogenetic measures of biodiversity and neo- and paleo-endemism in Australian Acacia. Nat Commun 5, 4473 (2014). https://doi.org/10.1038/ncomms5473



joelnitta/canaper documentation built on May 7, 2023, 10:28 a.m.