Convert a matrix or list of matrices to a bioregion (dis)similarity object
Source:R/as_bioregion_pairwise.R
as_bioregion_pairwise.RdConverts a (dis)similarity matrix or a list of such matrices into a
bioregion.pairwise object compatible with the bioregion package.
The input can come from base R, dist objects, or outputs from other
packages.
Arguments
- mat
A
matrix, adistobject, or alistof these representing pairwise similarity or dissimilarity values to convert into abioregion.pairwiseobject. This function can also directly handle outputs from other R packages (see thepkgargument).- metric_name
Optional
charactervector or singlecharacterstring specifying the name of the (dis)similarity metric(s), which will appear as column names in the output (see Note).- pkg
An optional
characterstring indicating the name of the package from whichmatwas generated (NULLby default, see Details). Available options are"adespatial","betapart","ecodist", or"vegan".- is_similarity
A
logicalvalue indicating whether the input data represents similarity (TRUE) or dissimilarity (FALSE).
Value
A dissimilarity or similarity object of class bioregion.pairwise,
compatible with the bioregion package.
Details
This function can directly handle outputs from ten functions across four packages:
adespatial: beta.div, beta.div.comp
betapart: beta.pair, beta.pair.abund, betapart.core, betapart.core.abund
vegan: vegdist, designdist
See the documentation of these packages for more information:
https://cran.r-project.org/package=adespatial
https://cran.r-project.org/package=betapart
https://cran.r-project.org/package=ecodist
https://cran.r-project.org/package=vegan
Note
If no specific package is specified (i.e., pkg = NULL), site names will be
based on the row names of the first matrix. If row names are NULL, they
will be generated automatically. If mat is a named list, those names will
be used as column names only if metric_name = NULL.
See also
For more details illustrated with a practical example, see the vignette: https://biorgeo.github.io/bioregion/articles/a3_pairwise_metrics.html.
Associated functions: dissimilarity similarity bind_pairwise
Author
Maxime Lenormand (maxime.lenormand@inrae.fr)
Boris Leroy (leroy.boris@gmail.com)
Pierre Denelle (pierre.denelle@gmail.com)