Don't write loops in R

Поділитися
Вставка

КОМЕНТАРІ • 17

  • @djangoworldwide7925
    @djangoworldwide7925 3 роки тому +8

    Only Chanel on UA-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.

  • @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 👍