Learn R Programming

cmahalanobis (version 0.5.0)

chamming: Calculate the Hamming distance of a factor in a dataframe.

Description

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

Usage

chamming(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Hamming Distance Between Groups"
)

Value

The matrix containing distances.

Arguments

dataset

A dataframe.

formula

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

plot

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

plot_title

The title of the plot.

Details

Calculate Hamming distance

Examples

Run this code

# Example with iris dataset

chamming(iris, ~Species, plot = TRUE, plot_title = "Hamming Distance Between Groups")

# Example with mtcars dataset

chamming(mtcars, ~am, plot = TRUE, plot_title = "Hamming Distance Between Groups")

Run the code above in your browser using DataLab