The profvis
package is a powerful tool for line profiling in R.
This package is provided by the RStudio team, and its most appreciated feature is the interactive report that is automatically produced, representing a really effective way of visualizing and investigating time resources requested by each part of your code.
Since the lineprof
package is not hosted on CRAN, but on GitHub, we first need it to install the devtools
package in order to leverage the install_github
function provided by this package.
Moreover, we will use the ggmap
package to build the example to be profiled:
install.packages(c("devtools","ggmap")) library(devtools) install_github("rstudio/profvis") library(profvis) library(ggmap)
Define a
profvis
object containing the code to be profiled. Run the following piece of code, initializing thereport
object.The following code is used from the drawing a route on a map with
ggmap
recipe in Chapter...