NaVar: Create new variable(s) indicating if there are missing values...

Description Usage Arguments Examples

Description

Create new variable(s) indicating if there are missing values in other variable(s)

Usage

1
NaVar(data, Var, Stub = "Miss_", reverse = FALSE, message = TRUE)

Arguments

data

a data frame object.

Var

a character vector naming the variable(s) within which you would like to identify missing values.

Stub

a character string indicating the stub you would like to append to the new variables' name(s).

reverse

logical. If reverse = FALSE then missing values are coded as 1 and non-missing values are coded as 0. If reverse = TRUE then missing values are coded as 0 and non-missing values are coded as 1.

message

logical. Whether or not to give you a message about the names of the new variables that are created.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Create data frame
a <- c(1, 2, 3, 4, NA)
b <- c( 1, NA, 3, 4, 5)
ABData <- data.frame(a, b)

# Create varibles indicating missing values in columns a and b
ABData1 <- NaVar(ABData, Var = c('a', 'b'))

# Create varible indicating missing values in columns a with reversed dummy
ABData2 <- NaVar(ABData, Var = 'a', reverse = TRUE, message = FALSE)

DataCombine documentation built on May 2, 2019, 11:26 a.m.