Fix transform_time() because of lubridate incompatibility #489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
this change is really minor, but fixes a strange incompatibility with
lubridate
.The bug:
This bug occurs in the wild, since
scales::transform_time()
is the default transformation forggplot2::scale_x_datetime()
.The underlying problem is that
lubridate
only provides a method forPOSIXct
and not forPOSIXt
. And the order of the classes is therefore important.https://github.com/tidyverse/lubridate/blob/fea9692686dcb0a968fa068d7f8dfdb41bbea581/R/ops-addition.r#L129
Also, the new order of the classes is the default order of
as.POSIXct
:Fixing this problem in
scales
seemed the easiest, since the alternative would be adding a lot of new methods tolubridate
.I don't know if there is a reason for the inverse class order. But I hope this is an easy fix.
Greetings
Alex