How to use walk to silently plot ggplot2 output with purrr

前端 未结 2 1323
再見小時候
再見小時候 2021-01-11 15:51

I am trying to understand how to use walk to silently (without printing to the console) return ggplot2 plots in a pipeline.

library         


        
2条回答
  •  再見小時候
    2021-01-11 16:13

    This should work

    10 %>%
      rerun(x = rnorm(5), y = rnorm(5)) %>%
      map(~ data.frame(.x)) %>%
      map(function(x) {
          ggplot(x, aes(x, y)) + geom_point()
      })
    

提交回复
热议问题