Learn R Programming

mSigTools (version 1.0.7)

sig_dist_matrix: Compute a matrix of distances / similarities between two sets of signatures.

Description

Compute a matrix of distances / similarities between two sets of signatures.

Usage

sig_dist_matrix(x1, x2, method = "cosine")

Value

A numeric matrix with dimensions

ncol(x1) X ncol(x2). Each element represents the distance or similarity (depending on method) between a column in x1 and a column in x2.

Arguments

x1

The first set of signatures (a numerical matrix-like object in which each column is a signature).

x2

The second set of signatures, similar data type to x1, and must have the same number of rows as x1.

method

As for the distance function in package philenropy.

Examples

Run this code
ex.sigs <- matrix(c(0.2, 0.8, 0.3, 0.7, 0.4, 0.6), nrow = 2)
colnames(ex.sigs) <- c("ex1", "ex2", "ex3")
ref.sigs <- matrix(c(0.21, 0.79, 0.19, 0.81), nrow = 2)
colnames(ref.sigs) <- c("ref1", "ref2")
sig_dist_matrix(ex.sigs, ref.sigs)

Run the code above in your browser using DataLab