label_matrix: Compute a Similarity or Distance Matrix for Categorical...

View source: R/label_sim.R

label_matrixR Documentation

Compute a Similarity or Distance Matrix for Categorical Labels

Description

Calculates a similarity or distance matrix between two categorical label vectors 'a' and 'b'.

Usage

label_matrix(
  a,
  b,
  type = c("s", "d"),
  return_matrix = TRUE,
  simfun = NULL,
  dim1 = length(a),
  dim2 = length(b)
)

Arguments

a

The first categorical label vector.

b

The second categorical label vector.

type

The type of matrix to construct, either a similarity ('s') or distance ('d') matrix.

return_matrix

A logical flag indicating whether to return the result as a sparse matrix (default: TRUE) or a triplet.

simfun

An optional user-provided similarity function. If not provided, a default similarity function will be used.

dim1

The length of the first dimension.

dim2

The length of the second dimension.

Value

A similarity or distance matrix between the categorical label vectors 'a' and 'b', either as a sparse matrix or a triplet.


bbuchsbaum/graphweights documentation built on April 4, 2024, 7:19 p.m.