Create an Indicator Matrix

Share:

Description

Creates an indicator matrix from a grouping vector.

Usage

1
indmat(grp.vec, K = length(unique(grp.vec)))

Arguments

grp.vec

Numeric vector giving the group membership.

K

Scalar indicating the number of groups. Defaults to the number of unique elements in grp.vec.

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