Created
May 13, 2017 20:13
-
-
Save daattali/6c5843880ac80eaca07887a93f91bd4d to your computer and use it in GitHub Desktop.
Update the time in a tab every time the tab opens
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(shiny) | |
ui <- fluidPage( | |
tabsetPanel( | |
id = "maintabs", | |
tabPanel( | |
"tab1", | |
"Current time is", | |
textOutput("time_out", inline = TRUE) | |
), | |
tabPanel( | |
"tab2", | |
"Tab2" | |
) | |
) | |
) | |
server <- function(input, output) { | |
output$time_out <- renderText({ | |
input$maintabs | |
format(Sys.time(), "%a %b %d %Y %X %Z") | |
}) | |
} | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment