Description Usage Arguments Value Author(s) Examples
This utility function launches a shiny visualization application, either in the RStudio viewer pane (if run under RStudio) or in the browser.
1 |
app |
The shiny application definition, see |
... |
additional arguments passed to |
The return value of shiny::runApp
.
Martin Morgan
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 | if (interactive()) {
require(shiny)
app <- list(
ui = fluidPage(
title="Who Am I?",
sidebarLayout(
position="left",
sidebarPanel(
h1("Your name"),
textInput("your_name", "Your name?", "Anonymous"),
actionButton("done", "Done")),
mainPanel(
"Hi", textOutput("your_name", inline=TRUE))
)),
server = function(input, output) {
output$your_name <- renderText(input$your_name)
observe({
if (input$done > 0)
isolate(stopApp(returnValue = input$your_name))
})
})
.runApp(app)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.