dissimilarity_to_similarity {bioregion} R Documentation

## Convert dissimilarity indices to similarity indices

### Description

This function converts a data.frame of dissimilarity indices (beta diversity) between sites to similarity indices.

### Usage

dissimilarity_to_similarity(dissimilaritydata)


### Arguments

 dissimilaritydata the output object from similarity_to_dissimilarity() or a data.frame with the first columns called "Site1" and "Site2", and the other columns being the similarity metrics.

### Value

A data.frame with additional class bioregion.pairwise.metric, providing one or several dissimilarity metric(s) between each pair of sites. The two first columns represent each pair of sites, and the other column represent dissimilarity metrics. Columns with names "a", "b", "c", "A", "B" and "C" are not altered.

### Note

The behaviour of this function changes depending on column names. Columns "Site1" and "Site2" are copied identically. If there are columns called "a", "b", "c", "A", "B", "C", they will also be copied identically.

If a column is called "Euclidean", its similarity will be calculated based on the following formula:

Euclidean similarity = (1 - Euclidean distance) / Euclidean distance

Otherwise, all other columns will be transformed into similarity with the following formula:

similarity = 1 - dissimilarity

### Author(s)

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

dissimilarity_to_similarity()

### Examples

comat <- matrix(sample(0:1000, size = 50, replace = TRUE,
prob = 1 / 1:1001), 5, 10)
rownames(comat) <- paste0("Site", 1:5)
colnames(comat) <- paste0("Species", 1:10)

simil <- similarity(comat, metric = "all")
simil

dissimilarity <- similarity_to_dissimilarity(simil)
dissimilarity

simil <- dissimilarity_to_similarity(dissimilarity)
simil



[Package bioregion version 1.0.0 Index]