The out-of-bounds functions in the scales package only work with continuous ranges. This oob function works on discrete values.
censor_discrete(x, range)
| x | A vector of values. |
|---|---|
| range | A character vector of values that should be kept. |
x with values not in range as NA.
#> [1] "a" "b" NA