Description Usage Arguments Path-like identifiers Author(s) References See Also Examples
Removes an option from anywhere within option container or
any of it subcontainers based on a path-like identifier
(e.g. "container/subcontainer/option_name"
.
1 2 3 |
id |
Signature argument. Object containing path-like name/ID information. |
where |
Signature argument.
Object containing information about the location of the option container
that is to be used. Typically, this either corresponds to the name/ID
of a package/package project or an instance of a custom class for which
suitable methods in the context of managing options are defined
(see other methods of this package that have signature arguments
|
strict |
|
... |
Further arguments to be passed to subsequent functions/methods. |
Values for id
are expected to be of structure a/b/c/.../z
,
i.e. path-like identifiers using a slash as separator.
The identifier is transformed to a$b$c$...$z
and then in turn to a
valid get or assign
expression
(i.e. something similar to getOptionContainer(...)$a$b$c$...$z
and
getOptionContainer(...)$a$b$c$...$z <- value
).
Of course, "atomic" paths (e.g. only a
) are also valid.
Janko Thyson janko.thyson@gmail.com
http://github.com/Rappster/optionr
rmAnywhereOption-char-char-method,
setAnywhereOption,
getAnywhereOption,
existsAnywhereOption
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ## Not run:
##------------------------------------------------------------------------------
## Default `where` //
##------------------------------------------------------------------------------
container <- initializeOptionContainer(overwrite = TRUE)
setAnywhereOption(id = "a", value = TRUE)
rmAnywhereOption(id = "a")
exists("a", container, inherits = FALSE)
setAnywhereOption(id = "a/b/c", value = 10)
rmAnywhereOption(id = "a/b/c")
exists("c", container$a$b, inherits = FALSE)
##------------------------------------------------------------------------------
## Different `where` //
##------------------------------------------------------------------------------
where <- "test"
container <- initializeOptionContainer(id = where, overwrite = TRUE)
".test" %in% names(options())
## --> option container assigned to R option `.test`
setAnywhereOption(id = "a/b/c", value = 10, where = where)
rmAnywhereOption(id = "a/b/c", where = where)
exists("c", container$a$b, inherits = FALSE)
where <- structure(list(id = "test"), class = "OptionContext.Test")
container <- initializeOptionContainer(id = where, overwrite = TRUE)
setAnywhereOption(id = "a/b/c", value = 10, where = where)
rmAnywhereOption(id = "a/b/c", where = where)
exists("c", container$a$b, inherits = FALSE)
##------------------------------------------------------------------------------
## Strictness //
##------------------------------------------------------------------------------
container <- initializeOptionContainer(overwrite = TRUE)
rmAnywhereOption(id = "a")
try(rmAnywhereOption(id = "a", strict = 2))
rmAnywhereOption(id = "a/b/c")
try(rmAnywhereOption(id = "a/b/c", strict = 2))
rmAnywhereOption(id = character())
try(rmAnywhereOption(id = character(), strict = 2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.