as.control.list {statnet.common} | R Documentation |
Convert to a control list.
Description
Convert to a control list.
Usage
as.control.list(x, ...)
## S3 method for class 'control.list'
as.control.list(x, ...)
## S3 method for class 'list'
as.control.list(x, FUN = NULL, unflat = TRUE, ...)
Arguments
x |
An object, usually a |
... |
Additional arguments to methods. |
FUN |
Either a |
unflat |
Logical, indicating whether an attempt should be made to detect whether some of the arguments are appropriate for a lower-level control function and pass them down. |
Value
a control.list
object.
Methods (by class)
-
as.control.list(control.list)
: Idempotent method for control lists. -
as.control.list(list)
: The method for plain lists, which runs them throughFUN
.
Examples
myfun <- function(..., control=control.myfun()){
as.control.list(control)
}
control.myfun <- function(a=1, b=a+1){
list(a=a,b=b)
}
myfun()
myfun(control = list(a=2))
myfun2 <- function(..., control=control.myfun2()){
as.control.list(control)
}
control.myfun2 <- function(c=3, d=c+2, myfun=control.myfun()){
list(c=c,d=d,myfun=myfun)
}
myfun2()
# Argument to control.myfun() (i.e., a) gets passed to it, and a
# warning is issued for unused argument e.
myfun2(control = list(c=3, a=2, e=3))