Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

hms support #123

Closed
romainfrancois opened this issue Oct 24, 2018 · 4 comments
Closed

hms support #123

romainfrancois opened this issue Oct 24, 2018 · 4 comments
Milestone

Comments

@romainfrancois
Copy link
Contributor

library(hms)
library(vctrs)

time <- hms(56, 34, 12)
str(time)
#>  'hms' num 12:34:56
#>  - attr(*, "units")= chr "secs"

# losing the `hms` class, and therefore the printing
time2 <- vec_c(time, time)
str(time2)
#>  'difftime' num [1:2] 45296 45296
#>  - attr(*, "units")= chr "secs"

I realize hms is just disguise on top of difftime. Should there be perhaps a vec_restore.difftime, or would we need to add support for hms in the hms package ?

@hadley
Copy link
Member

hadley commented Oct 24, 2018

I think we just need a vec_restore.hms and then everything should just work.

@romainfrancois
Copy link
Contributor Author

Maybe vec_type2 also:

> time <- hms::hms(56, 34, 12)
> vec_type(time)
hms()
> vec_type2(time, time)
Time difference of  secs

Otherwise, to never gets to be a hms in vec_restore

@hadley hadley added this to the 0.1.0 milestone Oct 30, 2018
@hadley
Copy link
Member

hadley commented Oct 30, 2018

Actually, this belongs in hms. I'll move it there.

@hadley hadley closed this as completed Oct 30, 2018
@hadley
Copy link
Member

hadley commented Oct 30, 2018

Now at tidyverse/hms#61

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

No branches or pull requests

2 participants