Apply functions depending on a condition

map_if_condition(.x, condition, .f_if_true = identity, .f_if_false = identity)

map_if_true(.x, condition, .f = identity)

map_if_false(.x, condition, .f = identity)

Arguments

.x

An object

condition

TRUE or FALSE

.f_if_true

Function to apply when `condition` is `TRUE`

.f_if_false

Function to apply when `condition` is not `TRUE`

.f

Function to apply

Value

`.x` or a function applied to `.x`, depending on `condition`