incase
R package incase by rossellhayes — release notes from GitHub.
A safer case_when that keeps hardening its guarantees while realigning to tidyverse naming.
◆Recent moves
- 11mo ago
Dotted arguments and an .exhaustive matching check
Undotted preserve/default/ordered arguments are deprecated in favour of dotted forms and now warn, while .exhaustive adds an opt-in error when input elements match no case. The .default argument's position now determines where the default value lands in factor levels, and grep_case() accepts vectors on the left-hand side.
View source ↗ - 2y ago
Dotted and undotted arguments both accepted
Arguments become accepted with or without leading dots and default is factored into output class resolution — the flexibility 0.4.0 later walks back. Also fixes replacement failing when a condition held only NA and FALSE values.
View source ↗ - 5y ago
Fix NULL return when no condition matches
Fixes *_case() returning NULL when no condition was TRUE, and adds tibble to Suggests. A correctness patch on the edge case, not a change in what the functions do.
View source ↗ - 5y ago
Factor and list return families arrive
The *_case_fct() and *_case_list() families arrive, returning factors ordered by case statement and lists that survive without automatic type coercion. This is where the package stopped being a case_when clone and started solving the return-type problem that motivates it.
View source ↗ - 5y ago
Drop unused stats import to clear a check NOTE
Removes an unnecessary stats import to clear a check NOTE and picks up a newer plu for error messages. Packaging housekeeping.
View source ↗ - 5y ago
Pattern and function-based matching families added
grep_case() adds pattern matching and fn_case()/fn_switch_case() let an arbitrary function build the comparison vectors. These expanded matching beyond exact equality and set up the family structure the later releases build on.
View source ↗