Learn R Programming

EvoPhylo (version 0.3.5)

get_gower_dist: Compute Gower distances between characters

Description

Computes Gower distance between characters from a phylogenetic data matrix.

Usage

get_gower_dist(x, numeric = FALSE)

Value

The Gower distance matrix.

Arguments

x

A phylogenetic data matrix in Nexus (.nex) format, or in any other data frame or matrix format with a column for each character and terminal taxa as rows, which will be read using ape::read.nexus.data. The data cannot include polymorphisms.

numeric

Whether to treat the values contained in the x as numeric or categorical. If FALSE (default), features will be considered categorical; if TRUE, they will be considered numeric.

Author

This function uses code adapted from StatMatch::gower.dist() written by Marcello D'Orazio.

See Also

vignette("char-part") for the use of this function as part of an analysis pipeline.

Examples

Run this code
# See vignette("char-part") for how to use this
# function as part of an analysis pipeline

# Load example phylogenetic data matrix
data("characters")

# Create distance matrix
Dmatrix <- get_gower_dist(characters)

# Reading data matrix as numeric data
Dmatrix <- get_gower_dist(characters, numeric = TRUE)

Run the code above in your browser using DataLab