View source: R/resolve.defaults.R
| resolve.defaults | R Documentation |
Determine the values of variables by applying several different default rules in a given order.
resolve.defaults(..., .MatchNull = TRUE, .StripNull = FALSE)
resolve.1.default(.A, ...)
... |
Several lists of |
.MatchNull |
Logical value. If |
.StripNull |
Logical value indicating whether
entries of the form |
.A |
Either a character string giving the name of the variable
to be extracted, or a list consisting of one |
These functions determine the values of variables by applying a series of default rules, in the order specified.
Each of the arguments ... should be a list of
name=value pairs giving a value
for a variable name. Each list could represent a
set of arguments given by the user, or a
rule assigning default values to some variables.
Lists that appear earlier in the sequence of arguments ...
take precedence.
The arguments ... will be concatenated into a single list.
The earliest occurrence of each name is then used to
determine the final value of the variable name.
The function resolve.defaults returns a list of
name=value pairs for all variables encountered.
It is commonly used to decide the values of
arguments to be passed to another function
using do.call.
The function resolve.1.default returns the value
of the specified variable as determined by resolve.defaults.
It is commonly used inside a function to determine the value
of an argument.
The result of resolve.defaults is
a list of name=value pairs.
The result of resolve.1.default can be any kind of value.
do.call
user <- list(day="Friday")
ruleA <- list(month="Jan", gravity=NULL)
ruleB <- list(day="Tuesday", month="May", gravity=42)
resolve.defaults(user, ruleA, ruleB)
resolve.defaults(user, ruleA, ruleB, .StripNull=TRUE)
resolve.defaults(user, ruleA, ruleB, .MatchNull=FALSE)
resolve.1.default("month", user, ruleA, ruleB)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.