fd_fric_intersect: Intersection between convex hulls of pairs of sites

View source: R/fd_fric_intersect.R

fd_fric_intersectR Documentation

Intersection between convex hulls of pairs of sites

Description

Compute volume of the intersection of the convex hulls of all pairs of sites (including self-intersection, which corresponds to their convex hull). Note that when standardizing convex hulls of intersections, this function uses the convex hull of all provided traits, thus standardized volume of self-intersection hulls can be lower than one. NB: FRic_intersect is equal to NA when there are strictly less species in one of the sites than the number of provided traits.

Usage

fd_fric_intersect(traits, sp_com, stand = FALSE)

Arguments

traits

Trait matrix with species as rows and traits as columns. It has to contain exclusively numerical values. This can be either a matrix, a data.frame, or a Matrix::Matrix() object.

sp_com

Site-species matrix with sites as rows and species as columns if not provided, the function considers all species with equal abundance in a single site. This can be either a matrix, a data.frame, or a Matrix::Matrix() object.

stand

a boolean indicating whether to standardize FRic values over the observed maximum over all species (default: FALSE). This scales FRic between 0 and 1. NB: The maximum FRic values only considers species that are present in both site-species and trait matrices. If you want to consider species that are absent in the site-species matrix, add corresponding columns of 0s.

Details

By default, when loading fundiversity, the functions to compute convex hulls are memoised through the memoise package if it is installed. To deactivate this behavior you can set the option fundiversity.memoise to FALSE by running the following line: options(fundiversity.memoise = FALSE). If you use it interactively it will only affect your current session. Add it to your script(s) or .Rprofile file to avoid toggling it each time.

Value

a data.frame with three columns:

  • first_site the names of the first site used in the pair sp_com,

  • second_site the names of the first site used in the pair,

  • FRic_intersect the volume of the convex hulls intersection of each pair of site.

NB: FRic_intersect is equal to NA when there are strictly less species in one of the sites than the number of provided traits. Note that only species with strictly different trait combinations are considered unique, species that share the exact same trait values across all traits are considered as one species.

Parallelization

The computation of this function can be parallelized thanks to future::plan(). To get more information on how to parallelize your computation please refer to the parallelization vignette with: vignette("fundiversity_1-parallel", package = "fundiversity")

See Also

fd_fric(), geometry::intersectn(), geometry::convhulln()

Examples

data(traits_birds)
fd_fric_intersect(traits_birds)


fundiversity documentation built on Nov. 21, 2022, 5:07 p.m.