A cool feature of SQL CASE WHEN is
CASE x
WHEN 1 then '1'
WHEN 2 then '2'
ELSE '>2'
END as switched_case
It would be nice to mimic this in fcase:
fcase(
x,
1, '1',
2, '2',
default = '>2'
)
maybe it should be a seprated function fswitch()
@shrektan , is that different from kit::nswitch you asked for ?
no but just data.table should have no dependencies and if we add in data.table we may should choose to implement it as a wrapper of fcase.
Most helpful comment
maybe it should be a seprated function
fswitch()