fct_remove: Remove levels from a factor

Description Usage Arguments Value See Also Examples

View source: R/factors.R

Description

Remove levels from a factor, meaning that observations with those levels are set to 'NA'.

Usage

1
fct_remove(f, lvls)

Arguments

f

A factor

lvls

Character vector of levels to remove

Value

A factor

See Also

fct_recode which can remove factor levels and fct_explicit_na which is the inverse, converting 'NA' to a factor level.

Examples

1
2
3
f <- factor(c("Low", "Medium", "High",
              "Refused to respond", "No response", "Not asked"))
fct_remove(f, c("Refused to respond", "No response", "Not asked"))

jrnold/rubbish documentation built on May 20, 2019, 2:05 a.m.