diff --git a/DESCRIPTION b/DESCRIPTION index c20e19098..223682049 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,6 +30,7 @@ Suggests: knitr URL: http://www.rstudio.com/shiny/ BugReports: https://github.com/rstudio/shiny/issues +Roxygen: list(wrap = FALSE) Collate: 'app.R' 'bootstrap-layout.R' diff --git a/NAMESPACE b/NAMESPACE index b6b814190..57049a16e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -31,8 +31,6 @@ export(a) export(absolutePanel) export(actionButton) export(addResourcePath) -export(addSubAppDir) -export(addSubAppObj) export(animationOptions) export(basicPage) export(bootstrapPage) @@ -124,6 +122,7 @@ export(runApp) export(runExample) export(runGist) export(runGitHub) +export(runReactiveDoc) export(runRmdContainer) export(runUrl) export(selectInput) diff --git a/R/app.R b/R/app.R index 9223b8d37..6bbf5badc 100644 --- a/R/app.R +++ b/R/app.R @@ -32,9 +32,7 @@ #' options=list(launch.browser = rstudio::viewer) #' ) #' -#' shinyAppDir( -#' -#' ) +#' shinyAppDir(system.file("examples/01_hello", package="shiny")) #' } #' #' @export diff --git a/R/server.R b/R/server.R index 5b33902d5..888c365a3 100644 --- a/R/server.R +++ b/R/server.R @@ -832,14 +832,12 @@ httpuvCallbackSet <- local({ ) }) -#' @export addSubAppObj <- function(appObj, workerId="") { appParts <- createAppObj(appObj$ui, appObj$server) path <- registerSubApp(appParts$httpHandlers, appParts$serverFuncSource, workerId) invisible(path) } -#' @export addSubAppDir <- function(appDir, workerId="") { oldwd <- getwd() setwd(appDir) diff --git a/inst/rmd-examples/reactive.Rmd b/inst/rmd-examples/reactive.Rmd new file mode 100644 index 000000000..1c52fe097 --- /dev/null +++ b/inst/rmd-examples/reactive.Rmd @@ -0,0 +1,26 @@ +# Reactive document 1 + +Here's some inputs + +```{r} +div( + selectInput("dataset", "Dataset", c("cars", "iris", "mtcars")), + numericInput("rows", "Rows to show", 5) +) +``` + +Here's some reactive stuff + +```{r} +ds <- reactive({ + get(input$dataset, pos="package:datasets", inherits=FALSE) +}) +output$table <- renderTable({ + head(ds(), input$rows) +}) +tableOutput("table") +output$plot <- renderPlot({ + plot(ds()) +}) +plotOutput("plot") +``` diff --git a/man/shinyAppObj.Rd b/man/shinyAppObj.Rd index ccef15adc..c3c242f3c 100644 --- a/man/shinyAppObj.Rd +++ b/man/shinyAppObj.Rd @@ -34,4 +34,20 @@ use these functions to create/run applications; they are intended for interoperability purposes, such as embedding Shiny apps inside a \pkg{knitr} document. } +\examples{ +\dontrun{ +shinyAppObj( + ui = fluidPage( + numericInput("n", "n", 1), + plotOutput("plot") + ), + server = function(input, output) { + output$plot <- renderPlot( plot(head(cars, input$n)) ) + }, + options=list(launch.browser = rstudio::viewer) +) + +shinyAppDir(system.file("examples/01_hello", package="shiny")) +} +}