toConditional: Convert Function to Function that is Called if Condition is...

View source: R/toConditional.R

toConditionalR Documentation

Convert Function to Function that is Called if Condition is Met

Description

Convert Function to Function that is Called if Condition is Met

Usage

toConditional(FUN)

Arguments

FUN

a function

Examples

square <- function(x) x^2
negate <- function(x) -x
`%>%` <- magrittr::`%>%`
do_square <- TRUE
do_negate <- TRUE
10 %>%
  toConditional(square)(do_square) %>%
  toConditional(negate)(do_negate)

KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.