Package 'cmahalanobis'

Title: Calculate Distance Measures for a Given List of Data Frames with Factors
Description: It provides functions that calculate Mahalanobis distance, Euclidean distance, Manhattan distance, Chebyshev distance, Hamming distance, Canberra distance, Minkowski distance, Cosine distance, Bhattacharyya distance, Jaccard distance, Hellinger distance, Bray-Curtis distance, Sorensen-Dice distance between each pair of species in a list of data frames. These metrics are fundamental in various fields, such as cluster analysis, classification, and other applications of machine learning and data mining, where assessing similarity or dissimilarity between data is crucial. The package is designed to be flexible and easily integrated into data analysis workflows, providing reliable tools for evaluating distances in multidimensional contexts.
Authors: Flavio Gioia [aut, cre]
Maintainer: Flavio Gioia <[email protected]>
License: GPL-3
Version: 0.5.0
Built: 2025-03-09 05:27:44 UTC
Source: https://github.com/cran/cmahalanobis

Help Index


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")

Calculate the Canberra distance for each species.

Description

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

Usage

ccanberra(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Canberra Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Canberra distances matrix.

plot

Logical, if TRUE, a plot of Canberra distances matrix is displayed.

plot_title

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

Value

A matrix containing Canberra distances between each pair of groups and the plot.

Examples

# Example with the iris dataset

ccanberra(iris, ~Species, plot = TRUE, plot_title = "Canberra Distance Between Groups")

# Example with the mtcars dataset
ccanberra(mtcars, ~am, plot = TRUE, plot_title = "Canberra Distance Between Groups")

Calculate the Bhattacharyya distance for each species.

Description

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

Usage

cbhattacharyya(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Bhattacharyya Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Bhattacharyya distances matrix.

plot

Logical, if TRUE, a plot of Bhattacharyya distances matrix is displayed.

plot_title

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

Value

A matrix containing Bhattacharyya distances between each pair of groups and the plot.

Examples

# Example with the iris dataset
cbhattacharyya(iris, ~Species, plot = TRUE, plot_title = "Bhattacharyya Distance Between Groups")

# Example with the mtcars dataset
cbhattacharyya(mtcars, ~am, plot = TRUE, plot_title = "Bhattacharyya Distance Between Groups")

Calculate the p_values matrix for each species, using Chebyshev distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using the Chebyshev distance for the distances calculation.

Usage

cchebyshev(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Chebyshev Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Chebyshev distance.

plot

If TRUE, displays a plot of distances.

plot_title

The title of plot.

Value

A matrix containing distances and, optionally, the plot.

Examples

# Example with iris dataset

cchebyshev(iris, ~Species, plot = TRUE, plot_title = "Chebyshev Distance Between Groups")

# Example with mtcars dataset

cchebyshev(mtcars, ~am, plot = TRUE, plot_title = "Chebyshev Distance Between Groups")

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")

Calculate the Euclidean distance of a factor in a dataframe.

Description

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

Usage

ceuclide(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Euclidean Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

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

plot

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

plot_title

The title of the plot.

Details

Calculate Euclidean distance

Value

The matrix containing distances.

Examples

# Example with iris dataset

ceuclide(iris, ~Species, plot = TRUE, plot_title = "Euclidean Distance Between Groups")

# Example with mtcars dataset

ceuclide(mtcars, ~am, plot = TRUE, plot_title = "Euclidean Distance Between Groups")

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"
)

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

Value

The matrix containing distances.

Examples

# 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")

Calculate the Hellinger distance for each species.

Description

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

Usage

chellinger(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Hellinger Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Hellinger distances matrix.

plot

Logical, if TRUE, a plot of Hellinger distances matrix is displayed.

plot_title

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

Value

A matrix containing Hellinger distances between each pair of groups and the plot.

Examples

# Example with the iris dataset

chellinger(iris, ~Species, plot = TRUE, plot_title = "Hellinger Distance Between Groups")

# Example with the mtcars dataset
chellinger(mtcars, ~am, plot = TRUE, plot_title = "Hellinger Distance Between Groups")

Calculate the Jaccard distance for each species.

Description

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

Usage

cjaccard(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Jaccard Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Jaccard distances matrix.

plot

Logical, if TRUE, a plot of Jaccard distances matrix is displayed.

plot_title

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

Value

A matrix containing Jaccard distances between each pair of groups and the plot.

Examples

# Example with the iris dataset

cjaccard(iris, ~Species, plot = TRUE, plot_title = "Jaccard Distance Between Groups")

# Example with the mtcars dataset
cjaccard(mtcars, ~am, plot = TRUE, plot_title = "Jaccard Distance Between Groups")

Calculate the Mahalanobis distance for each species.

Description

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

Usage

cmahalanobis(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Mahalanobis Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Mahalanobis distances matrix.

plot

Logical, if TRUE, a plot of Mahalanobis distances matrix is displayed.

plot_title

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

Value

A matrix containing Mahalanobis distances between each pair of groups and the plot.

Examples

# Example with the iris dataset

data(iris)

# Calculate the Mahalanobis distance with the cmahalanobis function
cmahalanobis(iris, ~Species, plot = TRUE, plot_title = "Mahalanobis Distance Between Groups")

# Example with the mtcars dataset
data(mtcars)

# Calculate the Mahalanobis distance with the cmahalanobis function
cmahalanobis(mtcars, ~am, plot = TRUE, plot_title = "Mahalanobis Distance Between Groups")

Calculate a Manhattan distance of a factor in a dataframe.

Description

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

Usage

cmanhattan(
  dataset,
  formula,
  plot = TRUE,
  plot_title = "Manhattan Distance Between Groups"
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Manhattan distance.

plot

If TRUE, show a plot of distances.

plot_title

The title of plot.

Details

Calculate Manhattan distance

Value

A matrix containing distances.

Examples

# Example with iris dataset

cmanhattan(iris, ~Species, plot = TRUE, plot_title = "Manhattan Distance Between Groups")

# Example with mtcars dataset

cmanhattan(mtcars, ~am, plot = TRUE, plot_title = "Manhattan Distance Between Groups")

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")

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"
)

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.

Value

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

Examples

# 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")

Generate a Microsoft Word document about the Bhattacharyya distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Bhattacharyya distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cbhattacharyya(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Bhattacharyya distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Bhattacharyya distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cbhattacharyya(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cbhattacharyya(mtcars, ~am)

Generate a Microsoft Word document about the Bray-Curtis distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Bray-Curtis distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cbraycurtis(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Bray-Curtis distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Bray-Curtis distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cbraycurtis(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cbraycurtis(mtcars, ~am)

Generate a Microsoft Word document about the Canberra distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Canberra distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_ccanberra(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Canberra distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Canberra distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_ccanberra(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_ccanberra(mtcars, ~am)

Generate a Microsoft Word document about the Chebyshev distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Chebyshev distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cchebyshev(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Chebyshev distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Chebyshev distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cchebyshev(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cchebyshev(mtcars, ~am)

Generate a Microsoft Word document about the Cosine distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Cosine distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_ccosine(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Cosine distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Cosine distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_ccosine(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_ccosine(mtcars, ~am)

Generate a Microsoft Word document about the Euclidean distance matrix and the p-values matrix with relative plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Euclidean distance matrix and the p-values matrix with relative plots.

Usage

generate_report_ceuclide(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Euclidean distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq".Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Euclidean distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_ceuclide(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_ceuclide(mtcars, ~am)

Generate a Microsoft Word document about the Hamming distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Hamming distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_chamming(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Hamming distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Hamming distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_chamming(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_chamming(mtcars, ~am)

Generate a Microsoft Word document about the Hellinger distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Hellinger distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_chellinger(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Hellinger distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Hellinger distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_chellinger(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_chellinger(mtcars, ~am)

Generate a Microsoft Word document about the Jaccard distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Jaccard distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cjaccard(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Jaccard distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Jaccard distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cjaccard(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cjaccard(mtcars, ~am)

Generate a Microsoft Word document about Mahalanobis distance matrix and p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about Mahalanobis distance matrix and p-values matrix with corresponding plots.

Usage

generate_report_cmahalanobis(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Mahalanobis distances matrix and p_values matrix.

pvalue.method

A method with which you want to calculate pvalue matrix.The default method is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

A number of permutations to define if you choose "permutation".

num.bootstraps

A number of bootstrap to define if you choose "bootstrap".

Value

A Microsoft Word document about Mahalanobis distances matrix and p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cmahalanobis(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cmahalanobis(mtcars, ~am)

Generate a Microsoft Word document about the Manhattan distance and the p-values matrices with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Manhattan distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cmanhattan(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Manhattan distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq".Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Manhattan distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cmanhattan(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_cmanhattan(mtcars, ~am)

Generate a Microsoft Word document about the Minkowski distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Minkowski distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_cminkowski(
  dataset,
  formula,
  p = 3,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Minkowski distance matrix and the p_values matrix.

p

Order of the Minkowski distance

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Minkowski distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_cminkowski(iris, ~Species, p = 3)

# Generate a report about "am" factor in mtcars dataset
generate_report_cminkowski(mtcars, ~am, p = 3)

Generate a Microsoft Word document about the Sorensen-Dice distance matrix and the p-values matrix with corresponding plots.

Description

This function takes a dataframe, a factor and returns a Microsoft Word document about the Sorensen-Dice distance matrix and the p-values matrix with corresponding plots.

Usage

generate_report_csorensendice(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 10,
  num.bootstraps = 10
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Sorensen-Dice distance matrix and the p_values matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

Value

A Microsoft Word document about the Sorensen-Dice distance matrix and the p_values matrix.

Examples

# Generate a report about "Species" factor in iris dataset
generate_report_csorensendice(iris, ~Species)

# Generate a report about "am" factor in mtcars dataset
generate_report_csorensendice(mtcars, ~am)

Calculate the p_values matrix for each species, using Bhattacharyya distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Bhattacharyya distance for the distances calculation.

Usage

pvaluescbatt(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Bhattacharyya distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescbatt(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescbatt(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Bray-Curtis distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Bray-Curtis distance for the distances calculation.

Usage

pvaluescbrcu(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Bray-Curtis distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescbrcu(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescbrcu(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Canberra distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Canberra distance for the distances calculation.

Usage

pvaluesccanb(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Canberra distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluesccanb(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluesccanb(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Chebyshev distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Chebyshev distance for the distances calculation.

Usage

pvaluesccheb(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Chebyshev distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluesccheb(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluesccheb(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Cosine distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Cosine distance for the distances calculation.

Usage

pvaluesccosi(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Cosine distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluesccosi(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluesccosi(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using the Euclidean distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Euclidean distance for the distances calculation.

Usage

pvaluesceucl(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Euclidean distances.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing the p_values matrix and, optionally, the plot. #' @examples # Calculate p_values of "Species" variable in iris dataset pvaluesceucl(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10) # Calculate p_values of "am" variable in mtcars dataset pvaluesceucl(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)


Calculate the p_values matrix for each species, using Hamming distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Hamming distance for the distances calculation.

Usage

pvalueschamm(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Hamming distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvalueschamm(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvalueschamm(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Hellinger distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Hellinger distance for the distances calculation.

Usage

pvalueschell(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Hellinger distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvalueschell(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvalueschell(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Jaccard distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Jaccard distance for the distances calculation.

Usage

pvaluescjacc(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Jaccard distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescjacc(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescjacc(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate p_values matrix for each species, using Mahalanobis distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of the species and a plot if the user select TRUE using Mahalanobis distance for distances calculation.

Usage

pvaluescmaha(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate the Mahalanobis distances matrix.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq".Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot a p_values heatmap. The default value is TRUE.

Value

A list containing the p-values matrix and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescmaha(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescmaha(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Manhattan distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Manhattan distance for the distances calculation.

Usage

pvaluescmanh(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe

formula

A factor which you want to calculate Manhattan distances.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A matrix containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescmanh(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescmanh(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Minkowski distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Minkowski distance for the distances calculation.

Usage

pvaluescmink(
  dataset,
  formula,
  p = 3,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Minkowski distance.

p

Order of the Minkowski distance

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescmink(iris,~Species, p = 3, pvalue.method = "chisq",
  num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescmink(mtcars,~am, p = 3, pvalue.method = "chisq", 
  num.permutations = 100, num.bootstraps = 10)

Calculate the p_values matrix for each species, using Sorensen-Dice distance as a base.

Description

This function takes a dataset, a factor, a p_value method, number of bootstraps and permutation when necessary, and returns a p_values matrix between each pair of species and a plot if the user select TRUE using Sorensen-Dice distance for the distances calculation.

Usage

pvaluescsore(
  dataset,
  formula,
  pvalue.method = "chisq",
  num.permutations = 100,
  num.bootstraps = 10,
  plot = TRUE
)

Arguments

dataset

A dataframe.

formula

A factor which you want to calculate Sorensen-Dice distance.

pvalue.method

A p_value method used to calculate the matrix, the default value is "chisq". Other methods are "permutation" and "bootstrap".

num.permutations

Number of permutation to specify if you select "permutation" in "pvalue.method". The default value is 100.

num.bootstraps

Number of bootstrap to specify if you select "bootstrap" in "p_value method". The default value is 10.

plot

if TRUE, plot the p_values heatmap. The default value is TRUE.

Value

A list containing a matrix of p_values and, optionally, the plot.

Examples

# Calculate p_values of "Species" variable in iris dataset
pvaluescsore(iris,~Species, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)
# Calculate p_values of "am" variable in mtcars dataset
pvaluescsore(mtcars,~am, pvalue.method = "chisq", num.permutations = 100, num.bootstraps = 10)