Dear List,

I have a wrapper function that creates a Shiny App, as illustrated below.

I'd like to include the function myApp() inside a package. I'd appreciate
your guidance here, as I could not find good instructions on this online.


myApp <- function(x) {
  require(shiny)
  shinyApp(
    ui = fluidPage(
      sidebarLayout(
        sidebarPanel(sliderInput("n", "Bins", 5, 100, 20)),
        mainPanel(plotOutput("hist"))
      )
    ),
    server = function(input, output) {
      output$hist <- renderPlot(
        hist(x, breaks = input$n,
             col = "skyblue", border = "white")
      )
    }
  )
}

myApp(rnorm(100))

Regards,
Axel.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to