cbraycurtis {cmahalanobis} | R Documentation |
Calculate the Bray-Curtis distance for each species.
Description
This function takes a dataframe and a factor in input, and returns a matrix with the Bray-Curtis distances about it.
Usage
cbraycurtis(
dataset,
formula,
plot = TRUE,
plot_title = "Bray-Curtis Distance Between Groups"
)
Arguments
dataset |
A dataframe. |
formula |
A factor which you want to calculate the Bray-Curtis distances matrix. |
plot |
Logical, if TRUE, a plot of Bray-Curtis distances matrix is displayed. |
plot_title |
The title to be used for the plot if plot is TRUE. |
Value
A matrix containing Bray-Curtis distances between each pair of groups and the plot.
Examples
# Example with the iris dataset
cbraycurtis(iris, ~Species, plot = TRUE, plot_title = "Bray-Curtis Distance Between Groups")
# Example with the mtcars dataset
cbraycurtis(mtcars, ~am, plot = TRUE, plot_title = "Bray-Curtis Distance Between Groups")
[Package cmahalanobis version 0.5.0 Index]