setDreamerr_check: Sets dreamerr argument checking functions on or off

View source: R/misc_funs.R

setDreamerr_checkR Documentation

Sets dreamerr argument checking functions on or off

Description

This function allows to disable, or re-enable, all calls to check_arg within any function. Useful only when running (very) large loops (>100K iter.) over small functions that use dreamerr's check_arg.

Usage

setDreamerr_check(check = TRUE)

Arguments

check

Strict logical: either TRUE of FALSE. Default is TRUE.

Author(s)

Laurent Berge

Examples


# Let's create a small function that returns the argument
#  if it is a single character string, and throws an error
#  otherwise:

test = function(x){
  check_arg(x, "scalar character")
  x
}

# works:
test("hey")
# error:
try(test(55))

# Now we disable argument checking
setDreamerr_check(FALSE)
# works (although it shouldn't!):
test(55)

# re-setting argument checking on:
setDreamerr_check(TRUE)



dreamerr documentation built on Aug. 24, 2023, 1:08 a.m.