Closed
Description
The revdeps (#3303) identified that using facet_grid()
or facet_wrap()
with a date variable is broken. This probably affects other S3 vectors as well.
library(ggplot2)
df <- data.frame(date = as.Date("2019-01-01"), x = 1, y = 1)
p <- ggplot(df, aes(x, y)) + geom_point()
p + facet_grid(vars(date))
#> Error in scale_apply(layer_data, x_vars, "train", SCALE_X, x_scales):
p + facet_wrap(vars(date))
#> Error in scale_apply(layer_data, x_vars, "train", SCALE_X, x_scales):
The error is in Facet(Grid|Wrap)$map_data()
, where there is a join between the layout and the panels. In one of these, date
is a factor, and in the other, it is an S3 Date
. This changed because of different behaviour between join_keys()
and its previous plyr counterpart.
Metadata
Metadata
Assignees
Labels
No labels