December 2017
Beginner to intermediate
470 pages
12h 29m
English
There's a common saying which states that you can't change what you can't measure. Even though you can technically change your code's performance in R, you definitely won't be able to know whether a change is worth it if you don't measure it. In this section, we will introduce three tools you can use to measure your code: Rprof(), system.time(), and microbenchmark(). The first two are included in R, and the third one requires the microbenchmark package to be installed. The Rprof() tool is used to profile code, while system.time() and microbenchmark() are used to benchmark code.