I am trying to parse a string representing a period consisting of minutes, seconds, and milliseconds. My preferred functions for this would come from the readr
package, where seconds and milliseconds may be seen jointly as partial seconds. Apparently, within this package there is a silent assumption that minutes are represented as two digits, i.e. padded with zeros.
readr::parse_time("1:23.456", format="%M:%OS") # doesn't work
readr::parse_time("01:23.456", format="%M:%OS") # works
The ms
function from lubridate
handles this straight out of the box:
lubridate::ms("1:23.456")
Any workaround for this so I can use parse_time
and other functions in readr
without resorting to pad with zeros myself?