-
Notifications
You must be signed in to change notification settings - Fork 206
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
Convert Period to numeric #420
Comments
Ok, I found Stepping through the function, it works like a component getter. Shouldn't the behavior be similar to a I'm slightly confused between duration and period, but it's so convenient to use |
Sorry for coming late on this. Periods don't have a predefined length, hence the warning.
Yes. This makes sense indeed. |
This behavior is undocumented but I agree that it doesn't make sense. |
BTW, there is |
Fixing as.numeric and also removing all other Let me know if you see more problems of this kind. Thanks. |
One last thing. No need to sum up peridos. You can produce those in one go: per <- period(hours = 10, minutes = 6)
as.numeric(per, "hours")
# [1] 10.1 |
Great @vspinu, and many thanks for the period tip ! |
I couldn't find the right way to do it, but it seems hard to convert Period elements to numeric.
This is the expected behavior (
as.numeric
ondifftime
)However Period objects only return the
unit
part of the Period, like components getters (second
,minute
, ... )The trick I found was to convert to duration, but I get a warning when converting
Period
toduration
.The text was updated successfully, but these errors were encountered: