ReDefMiss: Redefines missing covariates.

View source: R/ReDefMiss.R

ReDefMissR Documentation

Redefines missing covariates.

Description

Depending on the type of covariate (factor, numeric binary, continuous) and the interpretation of a missing, this function assigns a value to missings and possibly rescales the continuous variable or recodes a numeric binary one.

Usage

ReDefMiss(para, NAzero = F)

Arguments

para

Character. Name of the variable.

NAzero

Boolean. If TRUE NAs are simply replaced by 0; other values are left unchanged.

Details

If NAzero=FALSE: then if the variable is a numeric binary one (0,1 values), 0's are replaced by -1 and NAs are replaced by 0; if the variable is a factor, NAs are replaced by level "0" of the factor; if the variable is continuous (or ratio-scaled) then the median of the non-missing values is subtracted from those and NAs are replace by 0.

Value

Factor or numeric vector, representing the recoded variable

Author(s)

Mark A. van de Wiel


markvdwiel/ShrinkBayes documentation built on March 27, 2022, 7:47 p.m.