Displaying 1 result from an estimated 1 matches for "timesdefineinsid".
Did you mean:
timesdefineinside
2008 Oct 20
3
The evaluation of optional function arguments
...ding.)
Actually, I'll put (1) up here:
########################
## (1) The basic case ##
## The calling function
## passes an optional argument (bar), as a variable (bar=harry).
callTimes <- function(tom, harry) {
print(match.call(expand.dots=TRUE)) # callTimes(tom = 2, harry = 7)
timesDefineInside(foo=tom, bar=harry)
}
## The called function
## does not explicitly ask for bar.
timesDefineInside <- function(foo, ...) {
# Checks to ensure this code is only executed if bar is given.
print(match.call(expand.dots=TRUE)) # times(foo = tom, bar = harry)
bar <- match.call(expa...