Learn R Programming

cnd (version 0.1.0)

cnd_exports: Add conditions to functions

Description

[cnd_exports()] should be used within a package's building environment.

Usage

cnd_exports(env = parent.frame())

Value

Nothing, called for its side-effects

Arguments

env

The package environment

Examples

Run this code
e <- new.env()
registry <- cnd_create_registry("EXAMPLE", env = e)
local(envir = e, {
  my_fun <- function() NULL
  condition(
    "my_condition",
    package = "example_package",
    exports = "my_fun",
    registry = registry
  )
  cnd_exports()
})

# conditions are now added to my_fun():
e$my_fun
conditions(e$my_fun)

Run the code above in your browser using DataLab