removeColNa | R Documentation |
removeColNa()
Removes all columns of a data frame for which all entries are
NA, or the default of fct_explict_na
removeColNa(df)
df |
a data frame |
a data frame
Antoine Levesque
df <- data.frame(
character = letters[1:5],
factor = as.factor(LETTERS[1:5]),
value = 1:5,
unit = NA,
unit2 = forcats::fct_na_value_to_level(factor(NA), level = '(Missing)'),
stringsAsFactors = FALSE)
str(df)
str(removeColNa(df))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.