I have a question about reading a file with read_csv. I have times that look like this with hours, minutes, seconds and milliseconds:
6:19:43.722
When I use read_csv in readr to read them using col_time("%H:%M:%OS") it reads hours, minutes, and seconds just fine, but there are no milliseconds. I pulled getOption("digits.secs") to see how many digits on seconds should be displayed, but it says 3, as I’d like.
When I print out what I’ve read, it looks like
DATE TIME_M PRICE
1 2014-01-02 6:19:43 75.10
2 2014-01-02 6:19:49 75.10
3 2014-01-02 7:00:07 75.07
When I assign that first time to a variable and print it, I get 22783 which is the number of seconds since midnight—so no milliseconds.
To confuse things, if I try:
d<-"6:19:43.722"
> strptime(d,"%H:%M:%OS")
[1] "2016-03-07 06:19:43.722 EST"
strptime will strip that character vector just fine… just read_csv won’t with col_time. I have a very large dataset and I'd like to read it in with time correctly so I don't have to run through it again. Any thoughts?
Thanks