if (interactive()) {
library("shiny")
## A Simple Shiny App
shinyApp(
ui = fluidPage(
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(
sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30),
shinyURL.ui()
),
mainPanel(
plotOutput("plot")
)
)
),
server = function(input, output, session) {
shinyURL.server(session)
output$plot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
)
## Shiny Widgets Demo
shinyAppDir( system.file('examples', 'widgets', package='shinyURL') )
## Tabsets Demo
shinyAppDir( system.file('examples', 'tabsets', package='shinyURL') )
## Showcase demo available live at https://gallery.shinyapps.io/shinyURL
shinyAppDir( system.file('examples', 'showcase', package='shinyURL') )
## Interactive R Markdown document which uses a QR code to encode the URL
if (require("rmarkdown") && require("qrcode"))
run( system.file('examples', 'qrcode', 'qrcode.Rmd', package='shinyURL') )
## Use with dynamic user interface created by renderUI()
shinyAppDir( system.file('examples', 'dynamicUI', package='shinyURL') )
}
Run the code above in your browser using DataLab