dplyr and ggplot in R

pg %>% na.omit() %>% 
  ggplot(aes(x = bill_depth_mm, y = bill_length_mm, col = species)) +
  geom_point() + geom_smooth(method = "lm")

pg %>% na.omit() %>% 
  ggplot(aes(x = bill_depth_mm, y = bill_length_mm, col = species)) +
  geom_point(show.legend = F) + geom_smooth(method = "lm", show.legend = F) + 
  facet_wrap(~ species, ncol = 3)

pg %>% 
  group_by(year, species) %>% 
  tally() %>% 
  ggplot(aes(x = year, y = n, color= species)) +
  geom_point() + geom_line()

pg %>% 
  filter(!is.na(sex)) %>% 
  group_by(year, species, sex) %>% 
  tally() %>% 
  ggplot(aes(x = year, y = n, col = sex)) +
  geom_point() + geom_line() +
  facet_wrap(~species, ncol = n_distinct(pg$species)) +
  theme_bw() +
  theme(text = element_text(size=12),
               axis.text.x = element_text(angle=30, hjust=1),
        legend.position = "bottom")

.EOF.