Closed
Description
Should these be equivalent to ggplot(mtcars)
instead of failing?
ggplot(mtcars) + facet_wrap(vars())
#> Error: Can't subset with `[` using an object of class NULL.
ggplot(mtcars) + facet_wrap(NULL)
#> Error: Must specify at least one variable to facet by
Allowing empty specs would make sense in functions:
my_plot <- function(.data, .mapping, ...) {
ggplot(.data, .mapping) +
geom_point() +
facet_wrap(vars(...))
}
Then both of these would work, instead of just the latter:
my_plot(starwars, aes(mass, height / 100))
my_plot(starwars, aes(mass, height / 100), gender)
Metadata
Metadata
Assignees
Labels
No labels