1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny_module.R
\name{profvis_ui}
\alias{profvis_ui}
\alias{profvis_server}
\title{profvis UI for Shiny Apps}
\usage{
profvis_ui(id)
profvis_server(input, output, session, dir = ".")
}
\arguments{
\item{id}{Output id from \code{profvis_server}.}
\item{input, output, session}{Arguments provided by
\code{\link[shiny:callModule]{shiny::callModule()}}.}
\item{dir}{Output directory to save Rprof files.}
}
\description{
Use this Shiny module to inject profvis controls into your Shiny app. The
profvis Shiny module injects UI that can be used to start and stop profiling,
and either view the results in the profvis UI or download the raw .Rprof
data. It is highly recommended that this be used for testing and debugging
only, and not included in production apps!
}
\details{
The usual way to use profvis with Shiny is to simply call
\code{profvis(shiny::runApp())}, but this may not always be possible or desirable:
first, if you only want to profile a particular interaction in the Shiny app
and not capture all the calculations involved in starting up the app and
getting it into the correct state; and second, if you're trying to profile an
application that's been deployed to a server.
For more details on how to invoke Shiny modules, see \href{https://shiny.rstudio.com/articles/modules.html}{this article}.
}
\examples{
# In order to avoid "Hit <Return> to see next plot" prompts,
# run this example with `example(profvis_ui, ask=FALSE)`
if(interactive()) {
library(shiny)
shinyApp(
fluidPage(
plotOutput("plot"),
actionButton("new", "New plot"),
profvis_ui("profiler")
),
function(input, output, session) {
callModule(profvis_server, "profiler")
output$plot <- renderPlot({
input$new
boxplot(mpg ~ cyl, data = mtcars)
})
}
)
}
}
|