lapply: How to Replace for loops in R to create Several Plots

Поделиться
HTML-код
  • Опубликовано: 10 окт 2024

Комментарии • 12

  • @StatisticsGlobe
    @StatisticsGlobe 2 года назад +3

    Thank you for the nice video Wolf! I'm using lapply a lot, but I have never used it to create multiple graphics. That's a great idea! Regards, Joachim

    • @StatistikinDD
      @StatistikinDD  2 года назад

      Thanks, Joachim! Lots of applications ...

  • @kristinwindsland9615
    @kristinwindsland9615 2 года назад

    I have just discovered lapply and this was VERY helpful. Thank you!

  • @baruqrodrigues
    @baruqrodrigues 2 года назад

    great video, congratulations.

  • @KN-tx7sd
    @KN-tx7sd 2 года назад

    When I tried to run the r-codes I'm getting only one figure at a time. However, in your presentation, I can see 4-5 composite figures. Is there another command included in the function or loop to generate the composite figures you have shown in the video like ggarrange/ggpubr. Thank you, KN

    • @StatistikinDD
      @StatistikinDD  2 года назад

      Hi K N,
      I used a markdown-based format called xaringan (R package) for the presentation. In markdown, I used the chunk option
      fig.show = "hold"
      See here (or link in video description) : github.com/fjodor/functional-programming/blob/main/lapply.Rmd
      Details here: yihui.org/knitr/options/#plots
      Kind regards
      Wolf

  • @Black-ot4js
    @Black-ot4js 2 года назад

    Is there a way to use "lapply " with "openair" graphs?

    • @StatistikinDD
      @StatistikinDD  2 года назад

      Sure. lapply is not limited to Base R applications or in the type of functions you can use. You just need to pass the required arguments.
      If you need to pass several arguments at once, you may need to look into map2 / walk2 or pmap / pwalk from the purrr package.

  • @KN-tx7sd
    @KN-tx7sd 2 года назад

    can lapply be used to plot layers in a circular plot using packages like 'circlize'. If so can you kindly provide a link for the same?

    • @StatistikinDD
      @StatistikinDD  2 года назад

      Sorry, haven't used circlize yet.

    • @KN-tx7sd
      @KN-tx7sd 2 года назад

      @@StatistikinDD thanks for the prompt reply