binary_label_matrix: Create a Binary Label Adjacency Matrix

View source: R/label_sim.R

binary_label_matrixR Documentation

Create a Binary Label Adjacency Matrix

Description

Constructs a binary adjacency matrix based on two sets of labels 'a' and 'b', creating edges when 'a' and 'b' have the same or different labels, depending on the 'type' parameter.

Usage

binary_label_matrix(a, b = NULL, type = c("s", "d"))

Arguments

a

A vector of labels for the first set of data points.

b

A vector of labels for the second set of data points (default: NULL). If NULL, 'b' will be set to 'a'.

type

A character specifying the type of adjacency matrix to create, either "s" for same labels or "d" for different labels (default: "s").

Value

A binary adjacency matrix with edges determined by the label relationships between 'a' and 'b'.

Examples

data(iris)
a <- iris[,5]
bl <- binary_label_matrix(a, type="d")


bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.