Description Usage Arguments Value See Also Examples
This function takes care of investigating the enclosing functions arguments and identifying the missing ones. If they are missing and a default is given this value is assigned to the enclosing functions environment
1 | .fillDefaults(def)
|
def |
A named list of default values |
This function is called for its side effects
Set and get pangenome defaults with defaults
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 | # Should only be called within methods/functions
# This will obviously fail
## Not run:
t <- function(x) {
x+1
}
t()
## End(Not run)
# Using .fillDefaults
t <- function(x, defs) {
.fillDefaults(defs)
x+1
}
# With defaults
t(defs=list(x=5))
# Direct setting takes precedence
t(x=2, defs=list(x=5))
# Still fails if defs doesn't contain the needed parameter
## Not run:
t(defs=list(y='no no'))
## End(Not run)
# Usually defs are derived from the object in a method:
## Not run:
setMethod('fillDefExample', 'pgFull',
function(object, x, y) {
.fillDefaults(defaults(object))
x+y
}
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.