tidyverse / hms

A simple class for storing time-of-day values
https://hms.tidyverse.org/
Other
138 stars 25 forks source link

vec_math() and vec_arith() for hms #85

Closed earowang closed 3 years ago

earowang commented 4 years ago

Possible to have vec_math() and vec_arith() support for hms?

x <- hms::hms(hours = 0:9)
min(x)
#> Time difference of 0 secs
max(x)
#> Time difference of 32400 secs
x + 60
#> Time differences in secs
#>  [1]    60  3660  7260 10860 14460 18060 21660 25260 28860 32460

Created on 2020-06-23 by the reprex package (v0.3.0)

krlmlr commented 3 years ago

Thanks. I've tried multiple times in the past to no avail, it may be worth another shot with vctrs.

krlmlr commented 3 years ago

Unfortunately, vec_math() and vec_arith() don't help here. Certain coercions are baked deeply into base R, see https://github.com/tidyverse/hms/issues/18#issuecomment-344738097 for context.

krlmlr commented 3 years ago

It might be possible after all, tracked in #18.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.