I'm using DT in shiny to display decimal time currently.
Example here:
library(shiny)
library(DT)
library(dplyr)
library(magrittr)
# server-side processing
base<-as.POSIXct('2000-01-01 00:00:00 EST')
mtcars2 = mtcars[, 5:6]
mtcars2 %<>%
mutate(drat = base+(3600*drat),
wt = base+(3600*wt))
DT::datatable(mtcars2,
extensions = 'Buttons',
options = list(
scrollX = TRUE,
scrollY = TRUE,
pageLength = 10,
dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')
)
) %>%
formatDate( 1:2,method = 'toLocaleString', params = list('en-US',year = NULL))
I've been looking into using toTimeString
or similar methods from the formatDate()
section of DT's functions. How can I go about converting this from decimal time "2.3" hrs into "2:18"? I did find this question
after which I have upgraded DT to the latest dev version and included params=
but have been unsuccessful in finding the necessary combination to select for just HH:MM.