genStackCollector | R Documentation |
This function creates two functions that we use to a)
collect the call stack for calls to a function using
trace
and b) access the results.
callNames
returns the names of the functions being called
in a call stack.
genStackCollector(fun = NULL, num = 0, expansionFactor = 2)
fun |
the name of the function that we will |
num |
a guess as to the number of calls to this function so that
we can preallocate the |
expansionFactor |
a number that indicates by what factor to grow the list for storing the results should we have to extend it. |
A list with 2 elements - an update function and a value function.
Duncan Temple Lang
trace
z = genStackCollector(`[`)
trace(`[`, z$update)
mtcars[1, 2]
a = 1:10
a[2:3]
f = function(x) x[x > 4]
f(a)
lm(mpg ~ ., mtcars)
untrace(`[`)
z$value()
sapply(z$value(), length)
callNames(z$value()[[1]])
callNames(z$value()[[3]])
callNames(z$value()[[4]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.