Don't write loops in R

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ม.ค. 2025

ความคิดเห็น • 17

  • @djangoworldwide7925
    @djangoworldwide7925 3 ปีที่แล้ว +8

    Only Chanel on TH-cam for advanced r users. Thank you!

  • @brodriguesco
    @brodriguesco  4 ปีที่แล้ว +6

    At 20:17, it should be plan(multiprocess, workers = 4) for it to work.

    • @emintavlayan
      @emintavlayan 2 ปีที่แล้ว

      You are the man 👍

  • @kurtkessler3664
    @kurtkessler3664 4 ปีที่แล้ว +2

    Thank you Dr. Rodrigues! This is very helpful. I was able to use this immediately.
    However I had to do one more step after I created the purrr_dfr(). Because I may have 100+ xlsx files, I said:
    x

  • @raretapes8057
    @raretapes8057 2 ปีที่แล้ว +2

    I haven’t written a loop in over a year. In that time I stopped drinking, started donating a litre of blood per week and am able to exhibit a photographic memory. Jokes aside: loops suck. No more loops. No more off-by-one index errors.

  • @andrewchen3735
    @andrewchen3735 3 ปีที่แล้ว +1

    Hi Bruno, been following your video lately, great content!
    Just wondering, is there an advantage to use R on Spacemacs, or just your personal preference?

    • @brodriguesco
      @brodriguesco  3 ปีที่แล้ว +1

      it comes down to personal preference. Vim-mode in Rstudio is not that great, but is perfect in spacemacs!

  • @tighthead03
    @tighthead03 2 ปีที่แล้ว

    Another excellent video

  • @djangoworldwide7925
    @djangoworldwide7925 3 ปีที่แล้ว +1

    What's the difference between lapply and map?

    • @brodriguesco
      @brodriguesco  3 ปีที่แล้ว

      Hadley Wickham wrote a great answer here stackoverflow.com/a/47123420

  • @hansmeiser6078
    @hansmeiser6078 3 ปีที่แล้ว

    I get: Error in .f(.x[[i]], ...) : unused argument (.x[[i]]) with:
    counter

    • @brodriguesco
      @brodriguesco  3 ปีที่แล้ว

      counter needs to be an argument of the function

    • @hansmeiser6078
      @hansmeiser6078 3 ปีที่แล้ว

      @@brodriguesco hm...purrr::map(myVect,hello,counter) Error in .f(.x[[i]], ...) : unused argument (0)... Could you provide an example with arguments?

    • @brodriguesco
      @brodriguesco  3 ปีที่แล้ว

      sure, give me some time

    • @brodriguesco
      @brodriguesco  3 ปีที่แล้ว +1

      @@hansmeiser6078 here, hope this helps: gist.github.com/b-rodrigues/a3f2b5829d31988d64339f76971df726

    • @hansmeiser6078
      @hansmeiser6078 3 ปีที่แล้ว

      @@brodriguesco Thank you very much Bruno! Well, I would never guess it myself, that the error is caused by a variable standing in global env....amazing. For me its seems a little bit strange, that the trigger of hello in map() needs no param. named 'counter'.

  • @ratral
    @ratral 2 ปีที่แล้ว

    Thanks 👍