I once saw that someone ran an R script in which he managed to run a block of code, and then return the matrix of each function that was called in the code, and the total amount of time spent calculating this particular function. So, for example, I could do:
foo{ for(i in 1:10){ if(i < 5) {print i} }
which return something like
for: 10 ms
if: 2 ms
print: 34 ms
I would appreciate it if anyone knows the name of the function that does this.
source share