Learn R Programming

autovarCore (version 1.0-4)

explode_dummies: Explode dummies columns into separate dummy variables

Description

This function takes a matrix with dummy outlier columns, where there are possibly multiple ones. We first merge these columns to one and then explode them to obtain one dummy variable per column.

Usage

explode_dummies(outlier_dummies)

Arguments

outlier_dummies

A matrix of outlier dummy variables in columns.

Value

A matrix with dummy variables in columns, each having one nonzero index. The columns are named outlier_x, with x being the 1-based row index of the position that this dummy variable is masking.

Examples

Run this code
# NOT RUN {
outlier_dummies <- matrix(NA,
                          nrow = 5,
                          ncol = 3,
                         dimnames = list(NULL, c('rumination', 'happiness', 'activity')))
outlier_dummies[, 1] <- c(0, 0, 1, 0, 1)
outlier_dummies[, 2] <- c(0, 1, 1, 0, 0)
outlier_dummies[, 3] <- c(1, 0, 0, 0, 1)
outlier_dummies
autovarCore:::explode_dummies(outlier_dummies)
# }

Run the code above in your browser using DataLab