| profvis | R Documentation | 
This function will run an R expression with profiling, and then return an htmlwidget for interactively exploring the profiling data.
profvis(
  expr = NULL,
  interval = 0.01,
  prof_output = NULL,
  prof_input = NULL,
  timing = NULL,
  width = NULL,
  height = NULL,
  split = c("h", "v"),
  torture = 0,
  simplify = TRUE,
  rerun = FALSE
)
| expr | Expression to profile. The expression will be turned into the
body of a zero-argument anonymous function which is then called repeatedly
as needed. This means that if you create variables inside of  The expression is repeatedly evaluated until  Not compatible with  | 
| interval | Interval for profiling samples, in seconds. Values less than 0.005 (5 ms) will probably not result in accurate timings | 
| prof_output | Name of an Rprof output file or directory in which to save
profiling data. If  | 
| prof_input | The path to an  | 
| timing | The type of timing to use. Either  If  | 
| width | Width of the htmlwidget. | 
| height | Height of the htmlwidget | 
| split | Orientation of the split bar: either  | 
| torture | Triggers garbage collection after every  Note that memory allocation is only approximate due to the nature of the
sampling profiler and garbage collection: when garbage collection triggers,
memory allocations will be attributed to different lines of code. Using
 | 
| simplify | Whether to simplify the profiles by removing
intervening frames caused by lazy evaluation. Equivalent to the
 | 
| rerun | If  | 
An alternate way to use profvis is to separately capture the profiling
data to a file using Rprof(), and then pass the path to the
corresponding data file as the prof_input argument to
profvis().
print.profvis() for printing options.
Rprof() for more information about how the profiling
data is collected.
# Only run these examples in interactive R sessions
if (interactive()) {
# Profile some code
profvis({
  dat <- data.frame(
    x = rnorm(5e4),
    y = rnorm(5e4)
  )
  plot(x ~ y, data = dat)
  m <- lm(x ~ y, data = dat)
  abline(m, col = "red")
})
# Save a profile to an HTML file
p <- profvis({
  dat <- data.frame(
    x = rnorm(5e4),
    y = rnorm(5e4)
  )
  plot(x ~ y, data = dat)
  m <- lm(x ~ y, data = dat)
  abline(m, col = "red")
})
htmlwidgets::saveWidget(p, "profile.html")
# Can open in browser from R
browseURL("profile.html")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.