get_dist_matrix: Convert data frame of distances from compute_fit_metric to...

View source: R/get_dist_matrix.R

get_dist_matrixR Documentation

Convert data frame of distances from compute_fit_metric to distance matrix

Description

The function converts the data frame of distances computed using compute_fit_metric to a matrix of distances between all trees. Helpful to use for clustering.

Usage

get_dist_matrix(fit_metrics)

Arguments

fit_metrics

output object from compute_fit_metric

Examples


# Load packages
library(palmerpenguins)

# Load the Palmer penguins data
penguins <- na.omit(penguins)

# Fit a random forest
set.seed(71)
penguin_rf <-
  randomForest::randomForest(
    species ~ bill_length_mm + bill_depth_mm + flipper_length_mm + body_mass_g,
    data = penguins,
    ntree = 10
  )

# Compute fit metrics between all trees
fit_metrics <- compute_fit_metric(penguin_rf, penguins)

# Obtain the distance matrix
get_dist_matrix(fit_metrics)

goodekat/TreeTracer documentation built on April 19, 2023, 7:44 p.m.