Skip to content

R Tricks, etc.

Duncan Temple Lang edited this page Oct 29, 2016 · 2 revisions

Profiling

Counting the Number of Calls to One or More Functions

When profiling code (with Rprof()), we can get how much time a function took as part of the overall computation. However, it is often useful to also know how many times each function was called. This can be done with trace() and a closure. I put this into a package named CallCounter which is at https://github.com/duncantl/CallCounter