Learn R Programming

SciencesPo (version 1.3.7)

NAasMissing: NA to Missing

Description

Recode all NA values into missing in a data.frame of factors

Usage

NAasMissing(x, convert.to.factor = FALSE, missing.value = "MISSING")

Arguments

x
is a data.frame of factors
convert.to.factor
if TRUE all non-factor columns in x are converted to factors
missing.value
is the new value given to the NA values

Examples

Run this code
x <- as.data.frame(matrix(rep(c("a", "b", "c", NA), 3), ncol=3))
x
NAasMissing(x)

Run the code above in your browser using DataLab