ls_explicit_na | R Documentation |
list
of data.frame
Encode Categorical Missing Values in a list
of data.frame
ls_explicit_na(
data,
omit_tables = NULL,
omit_columns = NULL,
char_as_factor = TRUE,
na_level = "<Missing>"
)
data |
( |
omit_tables |
( |
omit_columns |
( |
char_as_factor |
( |
na_level |
( |
This is a helper function to encode missing values (i.e NA
and empty string
) of every character
and
factor
variable found in a list
of data.frame
. The label
attribute of the columns is preserved.
list
of data.frame
object with explicit missing levels.
df1 <- data.frame(
"char" = c("a", "b", NA, "a", "k", "x"),
"char2" = c("A", "B", NA, "A", "K", "X"),
"fact" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
"logi" = c(NA, FALSE, TRUE, NA, FALSE, NA)
)
df2 <- data.frame(
"char" = c("a", "b", NA, "a", "k", "x"),
"fact" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
"num" = c(1:5, NA)
)
df3 <- data.frame(
"char" = c(NA, NA, "A")
)
db <- list(df1 = df1, df2 = df2, df3 = df3)
ls_explicit_na(db)
ls_explicit_na(db, omit_tables = "df3", omit_columns = "char2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.