cminkowski: Calculate the Minkowski distance of a factor in a dataframe.

View source: R/cmahalanobis.R

cminkowskiR Documentation

Calculate the Minkowski distance of a factor in a dataframe.

Description

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

Usage

cminkowski(
  dataset,
  formula,
  p = 3,
  plot = TRUE,
  plot_title = "Minkowski Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

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

p

Order of the Minkowski distance

plot

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

plot_title

The title of the plot.

Details

Calculate Minkowski distance

Value

The matrix containing distances.

Examples


# Example with iris dataset

cminkowski(iris, ~Species, p = 3, plot = TRUE, plot_title = "Minkowski Distance Between Groups")

# Example with mtcars dataset

cminkowski(mtcars, ~am, p = 3, plot = TRUE, plot_title = "Minkowski Distance Between Groups")


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