binary_enc: Encode a character vector into a binary matrix

Description Usage Arguments Details Examples

View source: R/RcppExports.R

Description

Create a binary matrix for categorical data with optional noise

Usage

1
binary_enc(x, keys, as_equal = FALSE)

Arguments

x

The vector to be encoded

keys

The values to encode into

as_equal

Compare keys versus strings as being equal? Otherwise looks for the 'key' substring in x (default)

Details

The column of the resulting matrix will represent the encoded values, as specified in the keys parameter, retaining the order and accessible in the colnames of the resulting matrix. Note that elements of the keys parameter need to be unique. This function is used by fit_logistic_signature

Examples

1
2
 binary_enc(c('foo', 'bar', 'baz', 'bazinga'), c('foo', 'baz'))
 binary_enc(c('foo', 'bar', 'baz', 'bazinga'), c('foo', 'baz'), as_equal=TRUE)

lindberg-m/contextendR documentation built on Jan. 8, 2022, 3:16 a.m.