Guest User

Untitled

a guest
Nov 14th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. data(mtcars)
  2.  
  3. library(tidyverse)
  4.  
  5. mtcars_split <-
  6. mtcars %>%
  7. split(mtcars$cyl)
  8.  
  9.  
  10. plots <- map2(
  11. mtcars_split,
  12. names(mtcars_split),
  13. ~ggplot(data = .x, mapping = aes(y = mpg, x = wt)) +
  14. geom_jitter() +
  15. ggtitle(.y)+
  16. scale_y_continuous(limits=c(max(.y)/2,NA))
  17.  
  18. )
  19.  
  20. plots
Add Comment
Please, Sign In to add comment