How to parse milliseconds? How to parse milliseconds? r r

How to parse milliseconds?


Courtesy of the ?strptime help file (with the example changed to your value):

 z <- strptime("2010-01-15 13:55:23.975", "%Y-%m-%d %H:%M:%OS") z # prints without fractional seconds op <- options(digits.secs=3) z options(op) #reset options


You can also use strptime(time[1], "%OSn") where 0 <= n <= 6, without having to set digits.secs.

The documentation states "Which of these are supported is OS-dependent." so YMMV.