Create a gist now

Instantly share code, notes, and snippets.

@withr /server.R Secret
Created Oct 17, 2014

What would you like to do?
R fortunes
library(fortunes)
n <- nrow(read.fortunes())
shinyServer(function(input, output) {
update <- reactive({
if (input$action > 0){
sample(1:n, 1)
}
})
output$summary <- renderPrint({
fortune(update())
})
})
shinyUI(bootstrapPage(
tagList(
tags$head(
tags$title("Upload Data"),
tags$link(rel="stylesheet", type="text/css",href="style.css")
),
tags$body(
tags$h1("R fortunes:")
)
),
# headerPanel("R fortunes:"),
div(class='button', actionButton("action", "Next Fortune!")),
div(class='output', verbatimTextOutput("summary"))
))
div.button {
margin: 10px 20px;
}
div.output {
margin: 10px 20px;
width: auto;
}
h1 {
margin: 10px 20px;
}
pre {
font-size: 16px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment