tidyverse / hms

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

argument order in `hms()` #34

Closed npjc closed 7 years ago

npjc commented 7 years ago

I would like to ask for the argument order in hms() to reflect that suggested by the function/pkg name: hms.

library(hms)
# hours, minutes, seconds
x <- "11:10:09"
hms::as.hms(x)

So then I'd expect the creator function named hms() to have the arguments, in order, hours, minutes, seconds.

#> 11:10:09
hms::hms(11, 10, 9) # nope.
#> 09:10:11
hms::hms(9, 10, 11) # seconds, minutes, hours?
#> 11:10:09

shouldn't it be smh() then?

If not some justification of the design choice would be fanstastic to help me remember next time I go to use it 😃

krlmlr commented 7 years ago

The rationale is that hms(number_of_seconds) should just work; the order of the remaining arguments just follows.

On hindsight, calling the constructor smh() or smhd() would have been a smarter move, but I can't change the order of arguments now -- sorry.

npjc commented 7 years ago

ahhh I see. @krlmlr don't be sorry! Thanks for the good work.

Just for completeness: 👍 for smhd()

krlmlr commented 7 years ago

Happy to review a PR that implements smhd <- function(days, hours, ...), but this is not top priority for me.

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.