vec2ind: Transform a Vector into an Indicator Matrix

View source: R/svs.r

vec2indR Documentation

Transform a Vector into an Indicator Matrix

Description

A helper function for transforming a vector into an indicator matrix.

Usage

vec2ind(x, add_names = TRUE)

Arguments

x

A vector (which will internally be converted to a factor).

add_names

Logical specifying whether to add dimnames to the resulting indicator matrix.

Details

As of version 2.0.x of the svs package, this is essentially a wrapper for t(fac2sparse()) from the Matrix package.

Value

An indicator matrix.

See Also

dat2ind.


svs documentation built on June 24, 2024, 5:07 p.m.