Skip to content

Conversation

clauswilke
Copy link
Member

Validate mapping before data in layer(). Closes #2862

library(ggplot2)
library(magrittr)

ggplot(mtcars, aes(mpg, cyl)) %>%
  geom_point()
#> Error: `mapping` must be created by `aes()`
#> Did you use %>% instead of +?

ggplot(mtcars) %>%
  geom_point(aes(mpg, cyl))
#> Error: `mapping` must be created by `aes()`
#> Did you use %>% instead of +?

ggplot(mtcars) +
  geom_point(aes(mpg, cyl), list())
#> Error: `data` must be a data frame, or other object coercible by `fortify()`, not a list

Created on 2018-08-29 by the reprex package (v0.2.0).

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if unit test worth it or not. Not is probably fine.

@clauswilke clauswilke merged commit 71cb174 into tidyverse:master Aug 29, 2018
@clauswilke clauswilke deleted the issue-2862-mapping-data-error branch August 29, 2018 13:23
@lock
Copy link

lock bot commented Feb 25, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants