I have this piece of code to show some chart + last row from table, but date not showed properly in tableOutput, Any idea please ?
Last row is this
"date","confirmed","diff"
2020-11-19,56898415,650433
but shows this
18585.00 56898415.00 650433.00
Here is full code
ui <- fluidPage(
titlePanel("Confirmed Cases"),
sidebarLayout(
position='right',
sidebarPanel(
tableOutput("table1")
),
mainPanel(
plotlyOutput("distPlot")
))
)
# Define server logic ----
server <- function(input, output) {
data <- read_csv("confirmed_all.csv")
data_last <- tail(data,1)
output$table1 <- renderTable(data_last)
output$distPlot <- renderPlotly({
ggplotly(
ggplot(data, aes(x = date, y = confirmed)) +
geom_line(colour = "grey", aes(date, confirmed)) +
scale_y_continuous(labels = comma))
})
}
# Run the app ----
shinyApp(ui = ui, server = server)
Link to my new project http://webcovid19.online/
...
OK, looks that R is showing date in numeric output from 1970 (Posix date), but how to convert it back ? My current code looks lhis
data_last <- tail(data[ , c("date", "confirmed")],1)
to show only specified column
Here is small dataset
"date","confirmed","diff"
2020-01-27,2927,809
2020-01-28,5578,2651
2020-01-29,6167,589
2020-01-30,8235,2068