resolve.defaults {spatstat.utils} | R Documentation |
Determine Values of Variables Using Several Default Rules
Description
Determine the values of variables by applying several different default rules in a given order.
Usage
resolve.defaults(..., .MatchNull = TRUE, .StripNull = FALSE)
resolve.1.default(.A, ...)
Arguments
... |
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 |
Details
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.
Value
The result of resolve.defaults
is
a list of name=value
pairs.
The result of resolve.1.default
can be any kind of value.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au
See Also
Examples
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)