[R] Shiny App inside R Package

Axel Urbiz axel.urbiz at gmail.com
Sun Sep 17 19:31:12 CEST 2017


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]]



More information about the R-help mailing list