| name | profvis |
| description | R profvis package for interactive profiling. Use for visualizing R code profiling data. |
profvis
Interactive visualizations for profiling R code.
Basic Profiling
library(profvis)
profvis({
data <- read.csv("large_file.csv")
result <- lm(y ~ x, data = data)
summary(result)
})
Save Profile
p <- profvis({
})
htmlwidgets::saveWidget(p, "profile.html")
Profile Function
my_function <- function(n) {
x <- rnorm(n)
y <- x^2
mean(y)
}
profvis({
my_function(1e6)
})
Interval
profvis({
}, interval = 0.01)
Memory Profiling
profvis({
x <- 1:1e7
y <- x^2
rm(x)
gc()
})
Flame Graph
p <- profvis({
})
With Shiny
profvis({
runApp("myapp", display.mode = "normal")
}, interval = 0.01)
Pause Profiling
profvis({
pause(FALSE)
pause(TRUE)
})
Print Summary
p <- profvis({
})
print(p)
Tips
profvis({ fast_code() }, interval = 0.005)
profvis({
for (i in 1:10) {
my_function()
}
})