4
I know there is Rprof(), but it seems to me rather inaccurate compared to microbenchmark(). However, if I want to use the microbenchmark() I have to call the function 2 times, once to have her output and another to run her time (which seems quite impractical)
I do not know how to call the function only 1 time and have as response the normal output of it and also the execution time quite accurate.
That’s not the function, but follow an example of my problem:
teste <- function(x){
Rprof()
x <- x+2
Rprof(NULL)
return(summaryRprof())
}
guarda_x_e_tempo <- teste(2)
or
teste <- function(x){
x <- x+2
return(x)
}
guarda_x <- teste(2)
guarda_tempo <- teste(2)
What is your doubt?
– Leticia Rosa
do not know how to call the function only 1 time and have as a response the normal output of it and also the execution time quite accurate
– Adenilson Junior
Edit the question and add this information. Without it, your question is incomplete and can be flagged and closed.
– Leticia Rosa