similarity_to_dissimilarity {bioregion}R Documentation

Convert similarity metrics to dissimilarity metrics


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


similarity_to_dissimilarity(similarity, include_formula = TRUE)



the output object from similarity() or dissimilarity_to_similarity().


a boolean indicating if the metrics based on your own formula(s) should be converted (see Details). This argument is set to TRUE by default.


A data.frame with additional class bioregion.pairwise.metric, providing dissimilarity metric(s) between each pair of sites based on a similarity object.


The behavior 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 there are columns based on your own formula (argument formula in similarity()) or not in the original list of similarity metrics (argument metrics in similarity()) and if the argument include_formula is set to FALSE, they will also be copied identically. Otherwise there are going to be converted like they other columns (default behavior).

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

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

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

\(dissimilarity = 1 - similarity\)


Maxime Lenormand (, Boris Leroy ( and Pierre Denelle (

See Also

dissimilarity_to_similarity() similarity() dissimilarity()


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")

dissimilarity <- similarity_to_dissimilarity(simil)

[Package bioregion version 1.1.1 Index]