Description Usage Arguments Value Examples
Light wrapper around the aprof function to profile one function
1 | aprofFun(expr, FUN)
|
expr |
Expression to profile |
FUN |
The name of the function to profile, as a string (e.g. "f") |
An aprof object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # The function to profile
f = function(n, sim) {
# Simulate some data
x = rnorm(n, mean = 0, sd = 2)
t = data.frame(x)
for (i in 1:sim) {
y = x + rnorm(x, mean = 0, sd = 0.5)
t = cbind(t, y)
}
return(t)
}
# Another function calling f
g = function(x) {
print(x + x)
output = f(100, 100)
return(output)
}
# Profiling:
## f is run
prof = aprofFun(f(100, 100), "f")
viewProfHtml(prof)
## g is run, profiling either "g" or "f"
prof = aprofFun(g(10), "g")
viewProfHtml(prof)
prof = aprofFun(g(10), "f")
viewProfHtml(prof)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.