stub | R Documentation |
stub()
assigns all arguments of a given function as symbols
to the specified environment (usually the current environment)
stub(func, ..., envir = parent.frame())
func |
function for which the arguments should be stubbed |
... |
non-default arguments of |
envir |
environment to which symbols should be assigned |
Stub is thought to be used for interactive testing and unit testing. It does not work for primitive functions.
list of symbols that are assigned to envir
f <- function(x, y = 2, z = 3) x + y + z
args <- stub(f, x = 1) # assigns x = 1, y = 2 and z = 3 to current env
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.