Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

case..html

data.table::fcase() with vectorized default


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

case.(..., default = NA)

Arguments

...

Sequence of condition/value designations

default

Default value. Set to NA by default.

Examples

test_df <- tidytable(x = 1:10)

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

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.