Profiling R code

In the big data era, where we might have petabytes of data, maintaining the performance of applications is crucial. The application performance might go down because of data-loading operations or calculations. To detect such operations, we have a package called profvis. This tells us how much time a line of code takes to execute. Install the package as follows:

install.packages("profvis") 

RStudio has provided support for the profvis package. Let's take a look at how to use it:

library(profvis) 
profvis({ 
plot(iris$Sepal.Length,iris$Sepal.Width) 
 
plot(cars$speed,cars$dist) 
}) 

profvis encloses the code to be analyzed. In the following screenshot, we can see the output. For each line of code, we can see the memory usage with ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.