Skip to content
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

Implement col_duration() #549

Closed
sjackman opened this issue Nov 7, 2016 · 5 comments
Closed

Implement col_duration() #549

sjackman opened this issue Nov 7, 2016 · 5 comments
Labels
collector feature a feature request or enhancement

Comments

@sjackman
Copy link

sjackman commented Nov 7, 2016

I have a table of time durations in hms format. The number of hours can be greater than 24. Parsing this column with col_time fails with

Warning: 1 parsing failure.
row       col   expected      actual
  5 Wallclock valid date 24:56:18.90

My workaround is to use col_string and then parse the time format with hms(roll=TRUE). My suggestion for possible solutions would be to either add a col_duration parser, or add a roll=TRUE parameter to col_time.

@hadley hadley added collector feature a feature request or enhancement labels Dec 22, 2016
@jimhester
Copy link
Member

jimhester commented Feb 2, 2017

Reprex is

library(readr)
parse_time("24:56:18.90", format = "%H:%M:%S")
#> Warning: 1 parsing failure.
#> row col   expected      actual
#>   1  -- valid date 24:56:18.90
#> NA

@jimhester
Copy link
Member

jimhester commented Feb 7, 2017

This is unfortunately tricky to implement with the current implementation

@hadley hadley changed the title col_time: parsing failure 24:56:18.90 Implement col_duration() Feb 22, 2017
@hadley
Copy link
Member

hadley commented Feb 22, 2017

This needs a completely new collector for durations.

@jimhester jimhester added this to the backlog milestone Nov 19, 2018
@krlmlr
Copy link
Member

krlmlr commented Oct 3, 2019

Same for negative times:

readr::parse_time("-12:34:56")
#> Warning: 1 parsing failure.
#> row col   expected    actual
#>   1  -- time like  -12:34:56
#> NA

Created on 2019-10-03 by the reprex package (v0.3.0)

Can we solve it by a new placeholder %h that collects unrestricted signed hours, and check valid values when we collect %H? A new collector seems like too much work for too little gain.

@jimhester jimhester removed this from the backlog milestone May 11, 2021
@jimhester
Copy link
Member

jimhester commented May 11, 2021

We have the new placeholder, so I think that should be sufficient to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collector feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants