index2vec: Convert indicies to a binary vector

Description Usage Arguments Value Author(s) Examples

View source: R/common_code.R

Description

The function performs the opposite of which converting a set of integers to a binary vector

Usage

1
index2vec(x, vars, sign = FALSE)

Arguments

x

a vector of integers

vars

the number of possible locations

sign

a lgical; when true the data are encoded as -1/+1, and 0/1 otherwise

Value

a numeric vector

Author(s)

Max Kuhn

Examples

1
2
index2vec(x = 1:2, vars = 5)
index2vec(x = 1:2, vars = 5, sign = TRUE)

caret documentation built on Oct. 9, 2021, 5:09 p.m.