| Title: | Parametrized Active Bindings |
|---|---|
| Description: | Provides a simple interface for creating active bindings where the bound function accepts additional arguments. |
| Authors: | Kirill Müller [aut, cre] (ORCID: <https://orcid.org/0000-0002-1416-3412>), RStudio [cph, fnd] |
| Maintainer: | Kirill Müller <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.3.9007 |
| Built: | 2026-05-24 02:40:40 UTC |
| Source: | https://github.com/krlmlr/bindr |
Provides a simple interface for creating active bindings where the bound function accepts additional arguments.
See create_env() for creating an environment populated with active bindings,
and populate_env() for populating an existing environment.
Maintainer: Kirill Müller [email protected] (ORCID)
Authors:
Kirill Müller [email protected] (ORCID)
Other contributors:
RStudio [copyright holder, funder]
Useful links:
Report bugs at https://github.com/krlmlr/bindr/issues
Leverages makeActiveBinding() by allowing parametrized functions that take the name of the binding and an arbitrary number of additional arguments.
create_env(names, fun, ..., .envir = parent.frame(), .enclos = parent.frame()) populate_env(env, names, fun, ..., .envir = parent.frame())create_env(names, fun, ..., .envir = parent.frame(), .enclos = parent.frame()) populate_env(env, names, fun, ..., .envir = parent.frame())
names |
A name, or a list of names, or a character vector; in the latter case the names are mangled if they are not representable in the native encoding |
fun |
A function with at least one argument, which will be called
to compute the value of a binding. The function will be called with the
binding name as first argument (unnamed), and |
... |
Additional arguments to |
.envir |
The environment in which |
.enclos |
The enclosing environment ( |
env |
An environment |
env <- create_env(letters, paste0, "-lowercase") env$a env$c env$Z populate_env(env, LETTERS, paste0, "-uppercase") env$a env$Zenv <- create_env(letters, paste0, "-lowercase") env$a env$c env$Z populate_env(env, LETTERS, paste0, "-uppercase") env$a env$Z