ggplot2-solutions
ggplot2-solutions copied to clipboard
Exercise 5.6.2 #3 use geom_count() as indicated
https://github.com/kangnade/ggplot2-solutions/blob/e6ef9e3b271599f6e97afc0f8a3f012f276f9385/ggplot2_solutions_chapter5.Rmd#L220
The question clearly states
use geom_count() to create a plot
I believe it's a relatively easy & more concise alternative to the geom_bar() you made (which is a good job by the way!). Any of the following lines of code does the job:
ggplot2:::mpg %>% ggplot(aes(drv,trans)) + geom_count(stat = "sum", aes(size = after_stat(prop), group = drv)) # may replace with geom_point()
ggplot2::mpg %>% ggplot(aes(drv,trans)) + stat_sum(aes(size = after_stat(prop), group = drv)) # default geom is "point"
Warmly