coalesce_one_hot: Coalesce one-hot encoding back to a single variable

Description Usage Arguments Value

View source: R/pre_processing.R

Description

Helper function to reverse one-hot encoding post-imputation.

Usage

1
coalesce_one_hot(X, var_name, fast = TRUE)

Arguments

X

A data.frame, data.table or matrix, for a single variable

var_name

A character string, with the original variable label

fast

Boolean, indicating whether to choose category with highest predicted probability (TRUE), or use predicted probabilities as weights in draw from random distribution

Value

A vector of length equal to nrow(X), containing categorical labels corresponding to the columns of X


rMIDAS documentation built on Jan. 30, 2021, 9:05 a.m.