Skip to content

Instantly share code, notes, and snippets.

@daattali
Created May 13, 2017 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daattali/6c5843880ac80eaca07887a93f91bd4d to your computer and use it in GitHub Desktop.
Save daattali/6c5843880ac80eaca07887a93f91bd4d to your computer and use it in GitHub Desktop.
Update the time in a tab every time the tab opens
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