Skip to contents

Computes a full NxN matrix of correlation-based distances: 1 - cor(t(X), method=obj$method). No block-based exclusion is performed here.

Usage

# S3 method for class 'cordist'
pairwise_dist(obj, X)

Arguments

obj

A distance function object of class c("cordist", "distfun").

X

A numeric matrix (rows = observations, columns = variables).

Value

An N x N numeric matrix of pairwise distances.

Details

This function calculates correlation distances among the rows of X. If you have a block variable and wish to exclude same-block comparisons, handle that after obtaining this full matrix (e.g., in second_order_similarity).

Examples

X <- matrix(rnorm(100), 10, 10)
dist_obj <- cordist(method="pearson")
dist_matrix <- pairwise_dist(dist_obj, X)
#> Error in UseMethod("pairwise_dist"): no applicable method for 'pairwise_dist' applied to an object of class "c('cordist', 'distfun')"