ccosine: Calculate the Cosine distance of a factor in a dataframe.

View source: R/cmahalanobis.R

ccosineR Documentation

Calculate the Cosine distance of a factor in a dataframe.

Description

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

Usage

ccosine(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Cosine Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

The factor which you want to calculate the Cosine distances matrix.

plot

If TRUE, shows a plot of the Cosine distances matrix.

plot_title

The title of the plot.

Details

Calculate Cosine distance

Value

The matrix containing distances.

Examples


# Example with iris dataset

ccosine(iris, ~Species, plot = TRUE, plot_title = "Cosine Distance Between Groups")

# Example with mtcars dataset

ccosine(mtcars, ~am, plot = TRUE, plot_title = "Cosine Distance Between Groups")


cmahalanobis documentation built on April 3, 2025, 8:51 p.m.