I want to evaluate the performance of some code in different versions of R. This is basically quite simple:
- Run r
- Use
system.time() to measure the time it takes to run a piece of code. - Complete R
- Rinse and repeat in another version
Now I want to use knitr to create a report for this. So, it seems to me that I need a mechanism to start a new session in each fragment.
How to do it?
Sample code for knitr for demonstration This code depicts graphics using ggplot , but it is obvious that both versions return the same timings since I donβt know how to launch a new version of R for each fragment.
Comparison of R performance ========================================================
r knitr
Andrie
source share