vector_to_dummy: Create a dummy matrix from the elements in a vector

Description Usage Arguments Value Author(s) See Also Examples

View source: R/vector_to_dummy.r

Description

Create a dummy matrix based on the elements of a vector. Each column in the produced matrix is a dummy indicator.

Usage

1
  vector_to_dummy(avector)

Arguments

avector

a numeric vector

Value

A matrix of dummy variables

Author(s)

Gaston Sanchez

See Also

list_to_dummy, factor_to_dummy

Examples

1
2
3
4
5
# let's say you have a list like this
num_vec = c(2, 3, 1, 4)

# get dummy matrix
vector_to_dummy(num_vec)

gastonstat/turner documentation built on May 16, 2019, 6:38 p.m.