collectArgInfo | R Documentation |
This function is used to trace calls to a function and
collect information such as the class, typeof, length and dim
of each argument in the call.
The results are collected in a list that can then be
queried using gatherArgInfo
.
collectArgInfo(fn, op = getParamInfo, print = FALSE, envir = globalenv(),
col = genInfoCollectorFun(op, names(formals(fn, envir))),
...)
fn |
the name of the function to be trace, or the function itself |
op |
the function to be called for each argument in the call to get the information of interest. |
print |
a logical value passed to |
envir |
the environment in which to find the function to be traced |
col |
a list of functions used in the |
... |
passed directly to |
This returns a function which can be called to access the results.
One can pass it the name of a variable which will call
gatherArgInfo
for you.
Duncan Temple Lang
trace
g = function(a, b = 2){ invisible(list(length(a), class(b))) }
i = collectArgInfo(g)
g(mtcars, 1:10)
g(3, TRUE)
g(lm, matrix(0, 2, 3))
g("xyz", matrix(letters[1:6], 2, 3))
i()
i("class")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.