Learn R Programming

bioregion (version 1.3.0)

as_bioregion_pairwise: Convert a matrix or list of matrices to a bioregion (dis)similarity object

Description

Converts 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.

Usage

as_bioregion_pairwise(
  mat,
  metric_name = NULL,
  pkg = NULL,
  is_similarity = FALSE
)

Value

A dissimilarity or similarity object of class bioregion.pairwise, compatible with the bioregion package.

Arguments

mat

A matrix, a dist object, or a list of these representing pairwise similarity or dissimilarity values to convert into a bioregion.pairwise object. This function can also directly handle outputs from other R packages (see the pkg argument).

metric_name

Optional character vector or single character string specifying the name of the (dis)similarity metric(s), which will appear as column names in the output (see Note).

pkg

An optional character string indicating the name of the package from which mat was generated (NULL by default, see Details). Available options are "adespatial", "betapart", "ecodist", or "vegan".

is_similarity

A logical value indicating whether the input data represents similarity (TRUE) or dissimilarity (FALSE).

Author

Maxime Lenormand (maxime.lenormand@inrae.fr)
Boris Leroy (leroy.boris@gmail.com)
Pierre Denelle (pierre.denelle@gmail.com)

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

  • ecodist: distance, bcdist

  • 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

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

Examples

Run this code

mat <- matrix(runif(100), 10, 10)
rownames(mat) <- paste0("s",1:10)

pair <- as_bioregion_pairwise(list(mat,mat,mat), 
                              metric_name = NULL,
                              pkg = NULL,
                              is_similarity = FALSE)
                              
pair

Run the code above in your browser using DataLab