I'm trying to show a table with Shiny, but I have a problem showing dates in the right format. Here is an example of what I'm dealing with:
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
textInput("myfirstinput", "text1"),
textInput("mysecondinput", "text2"),
actionButton("button", "An action button")
),
mainPanel(
tableOutput("table1")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
selected <- as.Date('2000-01-01', "%Y-%m-%d")
selected <- as.list(selected)
output$table1 <- renderTable(selected)
}
# Run the application
shinyApp(ui = ui, server = server)
This works as well :)
selected <- as.character(as.Date('2000-01-01', "%Y-%m-%d"))
Enjoy and Keep Posting!
It seems to work if you change the line:
selected <- as.Date('2000-01-01', "%Y-%m-%d")
to:
selected <- format(as.Date('2000-01-01'), "%Y-%m-%d")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With