This function allows you to use multiple if/else statements in one call.
It is called like dplyr::case_when()
, but utilizes data.table::fifelse()
in the background for improved performance.
case_when(..., .default = NA, .ptype = NULL, .size = NULL)
A sequence of two-sided formulas. The left hand side gives the conditions, the right hand side gives the values.
The default value if all conditions evaluate to FALSE
.
Optional ptype to specify the output type.
Optional size to specify the output size.