tidyverse / hms

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

Should `hms()` use tidyverse recycling rules? #76

Closed DavisVaughan closed 5 years ago

DavisVaughan commented 5 years ago

Meaning:

hms::hms(1:10, minutes = 2)
#> Error: All arguments to hms() must have the same length or be NULL. Found length(seconds) = 10, length(minutes) = 1.

Would recycle to:

hms::hms(1:10, minutes = rep(2, 10))
#> 00:02:01
#> 00:02:02
#> 00:02:03
#> 00:02:04
#> 00:02:05
#> 00:02:06
#> 00:02:07
#> 00:02:08
#> 00:02:09
#> 00:02:10
krlmlr commented 5 years ago

I don't think so. In contrast to a record or a data frame, the values here are combined with addition, and recycling almost always is an error. This strictness is on purpose, it's easy to use rep() if really needed.

github-actions[bot] commented 3 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.