Skip to contents

Apply function if condition holds

Usage

apply_if(x, cond, f)

Arguments

x

Object to which function is applied conditionally.

cond

Logical.

f

Function that takes one argument x.

Value

If cond f(x), else x.