r_eda

geom_col()geom_bar()比较

参考 Strayer (2019)

Whereas geom_col() expects you to pass it a y-axis mapping column, geom_bar() doesn’t take a y-axis call (at least by default). DataCamp

# geom_col()
data %>%
  groupby(xAxisCol) %>%
  summarize(value = n()) %>%
  ggplot(aes(x = xAxisCol, y = value) + 
  geom_col()

# geom_bar()
data %>%
  ggplot(aes(x = xAxisCol)) +
  geom_bar()
Strayer, Nick. 2019. “Visualization Best Practices in R.” DataCamp. 2019. <https://www.datacamp.com/courses/visualization-best-practices-in-r>.