collapse_range: Collapse nodes and ranges based on divergence times

Description Usage Arguments Value References Examples

View source: R/collapse_range.R

Description

This function collapses nodes and geographic ranges based on species' divergence times at various time depths.

Usage

1
2
3
4
5
6
7
8
collapse_range(
  x,
  tree,
  n,
  species = "species",
  grids = "grids",
  format = "wide"
)

Arguments

x

A community matrix or data frame.

tree

A phylogenetic tree.

n

Time depth to slice the phylogenetic tree (often in millions of years for dated trees).

species

If format = “long” (the default), the column with the species name.

grids

The column with the sites or grids if format = “long”.

format

Format of the community composition data: “long” or “wide” with species as columns and sites as rows.

Value

Two community data frames: the collapsed community data and original community data

References

Daru, B.H., Farooq, H., Antonelli, A. & Faurby, S. (2020) Endemism patterns are scale dependent. Nature Communications 11: 2115.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(ape)
tr1 <- read.tree(text ="(((a:2,(b:1,c:1):1):1,d:3):1,e:4);")
com <- matrix(c(1,0,1,1,0,0,
                1,0,0,1,1,0,
                1,1,1,1,1,1,
                1,0,1,1,0,1,
                0,0,0,1,1,0), 6, 5,
              dimnames=list(paste0("g",1:6), tr1$tip.label))

collapse_range(com, tr1, n=1)

phyloregion documentation built on May 1, 2021, 9:06 a.m.