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

unique() returns an object of class numeric #97

Open
joethorley opened this issue Mar 9, 2021 · 2 comments
Open

unique() returns an object of class numeric #97

joethorley opened this issue Mar 9, 2021 · 2 comments

Comments

@joethorley
Copy link
Contributor

Perhaps I'm missing something but it would be helpful if unique() returned an object of class hms

library(hms)
unique(hms::as_hms("10:01:01"))
#> [1] 36061

Created on 2021-03-08 by the reprex package (v1.0.0)

@krlmlr
Copy link
Member

krlmlr commented Mar 9, 2021

Thanks. We could implement this method (and basically all base methods implemented for the "vctrs_vctr" class).

We could also inherit from "vctrs_vctr" to get these for free; I'm not sure if this class supports this mode of operation, and we'd need to update a bunch of packages that assume that the class is c("hms", "difftime").

With so many "if-s", I'd prefer the first route for now. Would you like to take a stab?

@joethorley
Copy link
Contributor Author

I'm happy to take a stab at the first route - expect a PR for unique.hms() by the end of the week and if that goes well more to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants