Created
November 9, 2012 08:02
-
-
Save jcheng5/4044364 to your computer and use it in GitHub Desktop.
Reactive time example
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
shinyServer(function(input, output) { | |
output$currentTime <- reactiveText(function() { | |
# Forces invalidation in 1000 milliseconds | |
invalidateLater(1000) | |
as.character(Sys.time()) | |
}) | |
randomData <- reactive(function() { | |
if (!input$pause) | |
invalidateLater(750) | |
runif(4) | |
}) | |
output$random <- reactiveTable(function() { | |
matrix(randomData(), 2, 2) | |
}) | |
}) |
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( | |
div(class="container", | |
p(strong("The time is:"), | |
textOutput("currentTime") | |
), | |
p(strong("Here's some random data:"), | |
tableOutput("random"), | |
checkboxInput("pause", "Pause updates", FALSE)) | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its cool... ^_^
https://beta.rstudioconnect.com/content/3073/