-
-
Save withr/d17fe7d161514fed287f to your computer and use it in GitHub Desktop.
R fortunes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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