1

I am trying to parse time strings in minutes, seconds and milliseconds using R, i.e. of the form 8:09.12 for 8 minutes and 9.12 seconds.

I tried the strptime function suggested here, but get this strange output:

> op <- options(digits.secs=3); strptime("8:09.10", "%M:%OS")
[1] "2022-10-02 00:08:09.1 BST"
> op <- options(digits.secs=3); strptime("8:09.11", "%M:%OS")
[1] "2022-10-02 00:08:09.11 BST"
> op <- options(digits.secs=3); strptime("8:09.12", "%M:%OS")
[1] "2022-10-02 00:08:09.11 BST"
> op <- options(digits.secs=3); strptime("8:09.13", "%M:%OS")
[1] "2022-10-02 00:08:09.13 BST"
> op <- options(digits.secs=3); strptime("8:09.14", "%M:%OS")
[1] "2022-10-02 00:08:09.14 BST"
> 

Why does it change 9.12 to 9.11? All other numbers work properly.

System info:

> R.version
               _                                
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          2.1                              
year           2022                             
month          06                               
day            23                               
svn rev        82513                            
language       R                                
version.string R version 4.2.1 (2022-06-23 ucrt)
nickname       Funny-Looking Kid    
KIAaze
  • 340
  • 1
  • 13

0 Answers0