case.: data.table::fcase() with vectorized default

Description Usage Arguments Examples

View source: R/case.R

Description

This function allows you to use multiple if/else statements in one call.

It is called like data.table::fcase(), but allows the user to use a vector as the default argument.

Usage

1
case.(..., default = NA)

Arguments

...

Sequence of condition/value designations

default

Default value. Set to NA by default.

Examples

1
2
3
4
5
6
test_df <- tidytable(x = 1:10)

test_df %>%
  mutate.(case_x = case.(x < 5, 1,
                         x < 7, 2,
                         default = 3))

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.