ic-single-use: Temporarily enable or disable 'ic()'

ic-single-useR Documentation

Temporarily enable or disable ic()

Description

These functions let you evaluate an expression with either ic() enabled or disabled without affecting if ic() is enabled globally.

Usage

with_ic_enable(expr)

with_ic_disable(expr)

Arguments

expr

An expression containing the ic() function.

Value

Returns the result of evaluating the expression.

Functions

  • with_ic_enable(): evaluates the expression with ic() enabled.

  • with_ic_disable(): evaluates the expression with ic() disabled.

Examples

ic_enable()

fun <- function(x) {
  ic(x * 100)
}

fun(2)

with_ic_disable(fun(2))

fun(4)

ic_disable()

fun(1)

with_ic_enable(fun(1))

icecream documentation built on Sept. 27, 2023, 5:08 p.m.