Transform a Vector into an Indicator Matrix

Share:

Description

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

Usage

1
vec2ind(x, add_names = TRUE)

Arguments

x

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

add_names

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

Details

This is essentially the function class.ind from the package MASS.

Value

An indicator matrix.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.