tidyverse / vroom

Fast reading of delimited files
https://vroom.r-lib.org
Other
621 stars 60 forks source link

fix issue with empty date and datetime columns #454

Closed philaris closed 1 year ago

philaris commented 2 years ago

Fixes #453

In older versions of R, like 3.6.3, there is an error when reading an empty date or date-time column with skip = 1.

vroom::vroom(I('date\n'), col_names = 'date', col_types = 'D', skip = 1L)
Error in as.Date.numeric(double()) : 'origin' must be supplied
Calls: <Anonymous> ... collector_value.collector_date -> as.Date -> as.Date.numeric
vroom::vroom(I('dt\n'), col_names = 'dt', col_types = 'T', skip = 1L)
Error in as.POSIXct.numeric(double()) : 'origin' must be supplied
Calls: <Anonymous> ... collector_value.collector_datetime -> as.POSIXct -> as.POSIXct.numeric

This commit fixes the error by using a character() vector instead of a double() vector.