I use ggplot2
pretty regularly, and I have to say this one has me befuddled.
Script is:
library(tidyverse)
data_frame(value = rbinom(n = 100, size = 100, prob = 0.3)) %>%
ggplot(mapping = aes(x = value)) %>%
geom_histogram()
sessionInfo()
Output is:
> library(tidyverse)
Loading tidyverse: ggplot2
Loading tidyverse: tibble
Loading tidyverse: tidyr
Loading tidyverse: readr
Loading tidyverse: purrr
Loading tidyverse: dplyr
Conflicts with tidy packages -------------------------------------------------------
filter(): dplyr, stats
lag(): dplyr, stats
>
> data_frame(value = rbinom(n = 100, size = 100, prob = 0.3)) %>%
+ ggplot(mapping = aes(x = value)) %>%
+ geom_histogram()
Error: Mapping must be created by `aes()` or `aes_()`
>
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.5.0 purrr_0.2.2 readr_1.0.0 tidyr_0.6.0 tibble_1.2
[6] ggplot2_2.2.1 tidyverse_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 assertthat_0.1 R6_2.2.0 grid_3.3.2
[5] plyr_1.8.4 DBI_0.5-1 gtable_0.2.0 magrittr_1.5
[9] scales_0.4.1 lazyeval_0.2.0 tools_3.3.2 munsell_0.4.3
[13] colorspace_1.3-2
Try it with a plus sign, I make this mistake at least once a week.
data_frame(value = rbinom(n = 100, size = 100, prob = 0.3)) %>%
ggplot(mapping = aes(x = value)) +
geom_histogram()