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

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ •

  • @StatisticsGlobe
    @StatisticsGlobe 3 роки тому +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  3 роки тому

      Thanks, Joachim! Lots of applications ...

  • @kristinwindsland9615
    @kristinwindsland9615 2 роки тому

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

  • @baruqrodrigues
    @baruqrodrigues 3 роки тому

    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