NEWS.md
preserve
, default
, and ordered
have been deprecated in favor of .preserve
, .default
, and .ordered
(#9).
switch_case()
, grep_case()
, and fn_case()
families gain an .exhaustive
argument (#11).
.exhaustive
is TRUE
, the function will throw an error if any elements of the input are not matched by case statements. This can be useful to ensure you aren’t accidentally forgetting to recode any values..default
argument is now taken into account when setting factor levels in *_case_fct()
functions (#10).
.default
argument is given before any case statements, the default value will be the first level of the factor; if the .default
argument is positioned in between two case statements, the default value will be ordered in between the value of the two case statements.grep_case()
and grep_case_fct()
now support vectors in the left-hand side of arguments (#8).*_case()
functions can now use lists as return values (#7).*_case()
functions no longer perform automatic type conversion on non-atomic return values (#7).default
or .default
(#5).default
into account when determining the class of output (#5).NA
s and FALSE
s with no TRUE
s.plu
functions (#4).*_case()
would return NULL
if no conditions were TRUE
.tibble
to suggested packages.*_case_fct()
family of functions
*_case()
equivalents, but return factorsin_case_fct(x < 10 ~ "Low", x < 20 ~ "Medium", default = "High")
returns a factor with levels "Low"
, "Medium"
, and "High"
.*_case_list()
family
*_case()
equivalents, but return listscondition
in if_case()
never takes one of the three logical values, the corresponding output is not evaluated.if_case()
no longer produces an error if condition
is only NA
.stats
.grep_case()
which works similarly to switch_case()
but uses pattern matching instead of exact matching.fn_case()
which applies a function to the input and each formula’s left-hand side to create the logical vectors used by in_case()
.fn_switch_case()
which applies a function to the left-hand side of each formula to create the vectors used by switch_case()
.