ggforce
ggforce copied to clipboard
facet_zoom fails on grouped input data
Found this out when trying to use facet_zoom
on what I thought was a very simple table. facet_zoom
doesn't appear to ignore grouping on the input data, which causes it to throw an error that seems to be from cbind_all
. This can easily be worked around by ungrouping, but often happens when I create new variables in a pipe before piping to ggplot
and feels unintuitive since usually ggplot2
ignores grouping. Using the readme example, to show it works fine without grouping:
library(dplyr)
library(ggforce)
#> Loading required package: ggplot2
iris %>%
group_by(Species) %>% # mutate(x = Sepal.Length / sum(Sepal.Length))
ggplot(aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species == "setosa")
#> Error: Argument 2 must be length 150, not 1
iris %>%
ggplot(aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species == "setosa")
Thanks a lot ! I couldn't figure out why I had this error ! Turns out that the grouping remains effective even after summarise()
This appears to be fixed