Learn R Programming

cmahalanobis (version 0.5.0)

csorensendice: Calculate the Sorensen-Dice distance for each species.

Description

This function takes a dataframe and a factor in input, and returns a matrix with the Sorensen-Dice distances about it.

Usage

csorensendice(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Sorensen-Dice Distance Between Groups"
)

Value

A matrix containing Sorensen-Dice distances between each pair of groups and the plot.

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Sorensen-Dice distances matrix.

plot

Logical, if TRUE, a plot of Sorensen-Dice distances matrix is displayed.

plot_title

The title to be used for the plot if plot is TRUE.

Examples

Run this code
# Example with the iris dataset

csorensendice(iris, ~Species, plot = TRUE, plot_title = "Sorensen-Dice Distance Between Groups")

# Example with the mtcars dataset
csorensendice(mtcars, ~am, plot = TRUE, plot_title = "Sorensen-Dice Distance Between Groups")

Run the code above in your browser using DataLab