Skip to contents

[Experimental] Can replace case_when() syntax and outputs an ordered factor in the same order as the cases, useful for meaningful ordering in plots and tables. This is because for case_when() the arguments are evaluated in order, so you must proceed from the most specific to the most general. Tables and plots will therefor be ordered by the evaluation order.

Usage

fct_case_when(...)

Arguments

...

A sequence of two-sided formulas. See ?dplyr::case_when for details

Value

An ordered factor vector of length 1 or n, matching the length of the logical input or output vectors, with the type (and attributes) of the first RHS. Inconsistent lengths or types will generate an error.