0

When I load my csv files, the milliseconds of my time variable disapear,

I think that when I load my files the milliseconds are being deleted. I tried several codes to try and display them such as:

format(coordinates$timestamps, "%H:%M:%OS3")

coordinates$timestamps <- as.POSIXct(coordinates$timestamps, format = " %H:%M:%OS3")

coordinates$time <- as.POSIXct(coordinates$time, format = ('%H:%M:%S.%f'))

coordinates <- data.frame(timestamps = as.POSIXct(Sys.time(), format = "%Y-%m-%d %H:%M:%OS4"))

format(coordinates$timestamps, "%Y-%m-%d %H:%M:%OS4")

I was expecting to get time in:

15:34:56.234

But I got this:

1970-01-01 15:34:56

Or this:

15:34:56.000

Can anyone help ? thanks !! :))

Andre Wildberg
  • 12,344
  • 3
  • 12
  • 29
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 27 '23 at 17:50
  • *"milliseconds of my time variable disapear"*: see [`options("digits.secs")`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html). In R (as with many languages), the value that is _shown/rendered_ on the console does not accurately reflect the degree of precision that is actually stored; a good example is `pi`, which is an irrationale number and might be printed to the console with only a few decimal places but it is indeed much more accurate. This is true for floating point in general, and time is just a floating-point with fancy rendering. – r2evans Feb 27 '23 at 18:28

0 Answers0