poissonconsulting / hmstimer

An R package to track elapsed clock time using a `hms::hms()` scalar.
https://poissonconsulting.github.io/hmstimer/
Other
2 stars 0 forks source link

add tmr_format() function to control conversion of hms object to character with control on digits #1

Closed joethorley closed 4 years ago

joethorley commented 5 years ago

Some example code - needs digits argument adding to main function

time_to_character <- function(time) {
  time <- tmr_round(time, digits = 3)

  msecs <- as.numeric(time) - floor(as.numeric(time))
  msecs <- formatC(msecs, digits = 3, format = "f")
  msecs <- substr(msecs, 2, 5)

  time <- tmr_floor(time)
  time <- paste0(time, msecs)
  time
}
joethorley commented 4 years ago

done

github-actions[bot] commented 2 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.