Maximal frustration in printing and parsing milliseconds in R

I've just spent an absurd amount of time figuring out how to parse millisecond times into R. (It's standard practice to timestamp tick data with milliseconds timing in a flat data file.) Turns out that there are two problems that I faced. One being that there is a almost-hidden, footnote option in the strptime( ) function (for converting characters to POSIX) in which it describes using format = "%H:%M%OS" instead of "%H:%M:%S" to parse fractional seconds. However, the second, and what's actually the one that's wasted much my time, is the fact that R ignores milliseconds in printing by default! For example, here's an output for the POSIXct representation of the integer value 1286564400.

"2010-10-08 15:00:00 EDT"

So even though I figured how to represent millisecond times in R a few hours ago, I never knew I did it simply because R is not printing the output that I wanted on screen every time I tried! After a couple hours of searching, trying, and frustrating, here's the one-liner command that solved my problem.


which changes the options of the display and thus I can see the following output from the same input as above.

"2010-10-08 15:00:00.344 EDT"

I guess that's why they say R has a steep learning curve! Yes, it is very powerful and flexible. But there are limited standards and the documentations are all over the place because it's a mish mash of user-contributed packages!