-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
readr::read_csv excludes milliseconds from timestamps #1095
Comments
This is a duplicate of #883 readr is actually reading the seconds, but R does not display fractional seconds by default. library(readr)
data <- read_csv("~/p/readr/sampleLog_2020-05-13 10-30-10.0167.csv")
#> Parsed with column specification:
#> cols(
#> .default = col_double(),
#> TimeStamp = col_datetime(format = ""),
#> Time = col_time(format = ""),
#> Date = col_date(format = ""),
#> Event = col_character(),
#> PupilTime = col_character(),
#> UnityToPupilTimeOffset = col_character(),
#> GazeConfidence = col_character(),
#> EyeCenter0X = col_character(),
#> EyeCenter0Y = col_character(),
#> EyeCenter0Z = col_character(),
#> EyeCenter1X = col_character(),
#> EyeCenter1Y = col_character(),
#> EyeCenter1Z = col_character(),
#> GazeNormal0X = col_character(),
#> GazeNormal0Y = col_character(),
#> GazeNormal0Z = col_character(),
#> GazeNormal1X = col_character(),
#> GazeNormal1Y = col_character(),
#> GazeNormal1Z = col_character(),
#> LocalGazeDirectionX = col_character()
#> # ... with 17 more columns
#> )
#> See spec(...) for full column specifications.
as.POSIXlt(data$TimeStamp[[1]])$sec
#> [1] 10.0177 Created on 2020-06-05 by the reprex package (v0.3.0) |
@jimhester I tried your command below and it works for the column |
The issue is still present 2.1.4. @jimhester, I don't think this is the display issue: OP's problem (and mine) is with the library(readr)
filename <- "sampleLog_2020-05-13 10-30-10.0167.csv"
test <- read_csv(filename)
print(as.double(test$Time[[1]]), digits = 20)
# 37810
test2 <- read_csv(filename, col_types = cols(Time = col_character))
> print(as.double(as_hms(test2$Time[[1]])), digits = 20)
[1] 37810.017699956893921 Maybe there is a format specification for |
(see original issue at tidyverse/purrr#764)
reading the following csv file with readr::read_csv removes milliseconds in timestamps (formatted
HH:mm:ss.ffff
). Reading with base read.csv works fine.with the following file
sampleLog_2020-05-13 10-30-10.0167.zip
try:
compare to
The text was updated successfully, but these errors were encountered: