The Pipe-Operator - %>% - in R | Tips and Tricks in R

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • I will give an introduction to the pipe-operator (%>%) in R. It is used to express a sequence of operations. Especially when working with data frames, this can come in quite handy.
    Video for installing R-packages: • R tutorial for beginne...
    R-Version used in this video: 4.0.0
    Subscribe: tiny.cc/tn2ynz
    Need help with R, Data Analytics, Statistics, or Mathematics?? I give private tutoring and consulting lessons for those subjects. No matter if it is for your next Statistics/Mathematics exam or if you need help with data analysis for your academic papers. Just contact me via leoschafer.data@gmail.com to discuss your inquiry :) (I can teach in English and German)
    Like to support this channel? Just follow the link tiny.cc/u3uynz to donate
    If you want to contact me: leoschafer.data@gmail.com
    Latest videos:
    R tutorial for beginners part 1 (installing R): • R tutorial for beginne...
    R tutorial for beginners part 2 (Intro to RStudio, running first commands): • R tutorial for beginne...
    R tutorial for beginners part 3 (creating vectors in R, generating data): • R tutorial for beginne...
    R tutorial for beginners part 4 (installing packages in R): • R tutorial for beginne...
    R tutorial for beginners part 5 (Descriptive Statistics): • R tutorial for beginne...

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

  • @ethanvirtudazo1657
    @ethanvirtudazo1657 2 года назад +1

    This was very helpful. Thank you!

  • @platinumwings8779
    @platinumwings8779 3 года назад +1

    This is the most clear and simple explanation about the operator .. thank you

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

    Best video on pipe operator. Thanks a lot Leo😇

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

    This might be the best explanation for 'pipe' on YT. Thanks a lot.

  • @parisneto
    @parisneto 2 года назад +1

    Love the short , objective format. Great work !

  • @TcRiverrat18
    @TcRiverrat18 2 года назад +1

    Thank you so much for this quick video! I was really struggling to understand the importance of using pipes, and I appreciate more examples to more fully flesh out their usage!

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

    Thanks, clear and concise!

  • @Maria-vv9qm
    @Maria-vv9qm 3 года назад +4

    Thank you, been confused on this for a while :)

  • @duncanespenshade3621
    @duncanespenshade3621 3 года назад +1

    Excellent video, thank you so much!

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

    This video made it so easy to understand the Pipe-Operator. YOU ROCK!

  • @frankappiah4112
    @frankappiah4112 Год назад

    Great video, very comprehensible

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

    stay motivated this was my first video from you and liked it...keep it up

  • @vinithernyabuto8006
    @vinithernyabuto8006 3 года назад

    Great illustration

  • @theforester_
    @theforester_ 3 года назад

    thanks very much! really helped me out.
    your english is so clear and easy to understand.
    big shoout out from Brazil

  • @hughjazz8416
    @hughjazz8416 4 года назад +2

    A recommendation, don’t stop! Make more immediately!

    • @leoschafer9142
      @leoschafer9142  4 года назад +1

      I would like to but I can't find the time at the moment. Hopefully I can produce more content soon.

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

    nice one leo. am loving it

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

    Keep up the great work. Subscribed!

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

    THANK YOU ,it's very clear !!!! Looking forward to more of your works!

  • @evatang9397
    @evatang9397 2 года назад +1

    Thanks Leo! you explained the pipe operator very well with simple example to more complicated example! I now understand the "chain" effect by using the %>% very well! Subscribed! Thanks again.

  • @osmanmohamed2422
    @osmanmohamed2422 3 года назад +1

    Thank you so much, your explanation was clear and simple

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

    thank you leo. its very helpful

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

    Nice, Please do post more videos if you can. You are helping many others like me learn a lot outside the classroom.

  • @gerson9811
    @gerson9811 3 года назад +3

    Just what I needed 👍

  • @alex-sd
    @alex-sd 2 года назад

    Excellent explanation of what is the pipe operator and why it is useful. It helped me a lot. Thanks so much!!

  • @silmoonislam9537
    @silmoonislam9537 3 года назад

    thank you..really needed it...

  • @dhanushkabadhuge277
    @dhanushkabadhuge277 Год назад

    Thank you so much your great explanation.it is very helpful .

  • @MinhNguyenDzai
    @MinhNguyenDzai Год назад

    Very straight-forward, very helpful

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

    Very helpful! Thank you!

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

    Thank you! Simple and to the point. Very informative.

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

    thank you so much it was very overwhelming

  • @teampark7475
    @teampark7475 3 года назад

    Thank you. It was helpful.

  • @martinagreen7146
    @martinagreen7146 Год назад

    great video! I finally got my %>% working! Thanks a lot!

  • @Matt-ke7mc
    @Matt-ke7mc 3 года назад

    Awesome video! Thanks man.

  • @nurinarifah9091
    @nurinarifah9091 2 года назад +1

    I was wondering what the symbol %>% means. You sum it up pretty awesome and very easy to understand too. Subscribed, thanks!

  • @valerionetophdcandidate
    @valerionetophdcandidate Год назад

    I started to understand better with this video. Congrats

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

    Thank you, very clear😊

  • @bachlam9841
    @bachlam9841 3 года назад +1

    Thank you a lot. Your explanation is pretty clear!

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

    it was really helpful. Am new in learning R so i will need more of these videos so i get better

  • @shakhzodnishonov3873
    @shakhzodnishonov3873 3 года назад

    very straightforward explanation. GJ.

  • @dominiquebarrette9621
    @dominiquebarrette9621 3 года назад +1

    So well explined!

  • @AJEETSINGH-dl7sw
    @AJEETSINGH-dl7sw 3 года назад +1

    Helpful 🙂

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

    Wonderful!

  • @TerranWithCare
    @TerranWithCare 3 года назад

    Clear and tidy.
    Thank you! 🙏

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

    good explanation!

  • @clockmaster7401
    @clockmaster7401 3 года назад

    Thanks! It was very clear and helpul!

  • @hernanlarrivavillarreal4645
    @hernanlarrivavillarreal4645 3 года назад

    Excelent! Thanks!

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

    Amazing!

  • @HoneyBee03122011
    @HoneyBee03122011 3 года назад +1

    Thank you!

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

    Thanks!

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

    Thank you sir

  • @favourebubechukwu3592
    @favourebubechukwu3592 3 года назад

    Thank you

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

    I love learning from a man who speaks english.

  • @laylaburghli8515
    @laylaburghli8515 3 года назад

    very useful

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

    Thank you sir, was a really clear explaination. ✌🏻

  • @huqsami
    @huqsami Год назад

    Thanks ❤

  • @yisheng1084
    @yisheng1084 3 года назад

    excellent

  • @maxamaya8480
    @maxamaya8480 3 года назад

    Thanks! this was awesome

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

    thank you.

  • @naturespeace5180
    @naturespeace5180 4 года назад

    Thanks so much, you are the best.

  • @jaggr1287
    @jaggr1287 3 года назад +1

    Great video, would love to see more simple tidyverse tricks!

    • @gusulises1758
      @gusulises1758 3 года назад

      Sorry to be offtopic but does anyone know of a method to get back into an Instagram account?
      I stupidly lost the account password. I would appreciate any tips you can offer me.

    • @jesiahquincy8384
      @jesiahquincy8384 3 года назад

      @Gus Ulises instablaster :)

    • @gusulises1758
      @gusulises1758 3 года назад

      @Jesiah Quincy Thanks so much for your reply. I got to the site thru google and I'm waiting for the hacking stuff now.
      I see it takes a while so I will get back to you later when my account password hopefully is recovered.

    • @gusulises1758
      @gusulises1758 3 года назад

      @Jesiah Quincy it did the trick and I finally got access to my account again. I'm so happy!
      Thanks so much you saved my account !

    • @jesiahquincy8384
      @jesiahquincy8384 3 года назад

      @Gus Ulises You are welcome :D

  • @Виктор-ъ4р7н
    @Виктор-ъ4р7н 2 года назад +2

    Спасибо дружище!
    Мне трудно читать документацию на английском, а твоё видео прямо помогло :)

  • @Yu-Xiao-2028
    @Yu-Xiao-2028 3 года назад

    Thumbs up, thanks so much!

  • @willatkinson141
    @willatkinson141 3 года назад

    Perfect!

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

    Great video. Please, what RStudio theme did you use here?

  • @dominiquebarrette9621
    @dominiquebarrette9621 3 года назад

    I mean So well explained thank you

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

    Aha, so it's just like 'With' function in VBA. Is it not confusing that one ends the 'pipe' function with the exact same argument ("%>%"), versus something like End If in VBA?

  • @upulaherath7204
    @upulaherath7204 3 года назад

    Please make more 🙏🙏🙏

  • @anjaliadap2544
    @anjaliadap2544 3 года назад

    Great explanation!
    One question though, what would the final example look like without the usage of the pipe operator?

    • @leoschafer9142
      @leoschafer9142  3 года назад

      Hi Anjali, glad the video helped. Without the usage of the pipe operator you would get an error message. Be sure to try that out yourself in your R-Studio workspace :)

  • @WahranRai
    @WahranRai 2 года назад +1

    2:21 I prefer line 3 print("Hello world") than line 4 ! I never use piping and i think they destroying the simplicity of R.
    Read Python, Matlab, Javascript etc the code is simple and meaningful !
    You have cascade of %>% : we have to read preceding statement to understand the code !
    DON'T USE IT : keep it simple and understandable by everyone

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

    Hi Leo, is there a way to get pipes to tell you all values in a data set above or below a certain value instead of the summary? Thanks!

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

      Hi Adriana, thank you for your question. Do you mean of a certain variable? For example, if you have a variable "height" and you want to look at all entries with height greater 180, you can just do data %>% filter(height > 180). Does that answer your question?

  • @f.w.mulder9159
    @f.w.mulder9159 3 года назад

    Thank you for the video. Can you also use the pipe operator for for instance addition of two vectors? It does not seem to work if I put it in like this:
    cons_b2019 %>% tar_oud_ind + tar_oud_dir
    Error in tar_oud_ind(.) : could not find function "tar_oud_ind"
    because there is no function. Is there a way to do that? Would come in very handy because I need to manipulate the exact same dataset for different years and if I know how to use the pipe correctly I can easily reuse the codes for other datasets

    • @leoschafer9142
      @leoschafer9142  3 года назад

      Hi, thank you for your question. I'm not certain if I understood your question correctly. However, you need to know that the pipe-operator is only for the purpose of chaining functions. When it comes to summing vectors, the code:
      vector %>% sum()
      sums up all the entries stored in vector, for example.
      The example code you provided does not make sense to the naked eye, I'm afraid.

  • @lisaamante5384
    @lisaamante5384 3 года назад

    Las Vegas, NV, USA: Very clear, thank you! Would you happen to have any idea why this doesn't work in RStudio on my laptop? I made sure to have the dplyr and magrittr are loaded with the rest of the tidyverse elements but nothing happens.

    • @leoschafer9142
      @leoschafer9142  3 года назад

      Difficult to say without seeing your code and your error message. If you want you can post them both here so that I can take a look :)

    • @lisaamante5384
      @lisaamante5384 3 года назад +1

      @@leoschafer9142 Thanks, Leo! Turns out, I was writing my code in the console, bottom left pane. When I write it in the top left pane, Source Editor pane, I now see the results populate below in the console pane.

    • @leoschafer9142
      @leoschafer9142  3 года назад

      @@lisaamante5384 Super, glad you got it worked out!

  • @hackkked
    @hackkked 3 года назад

    Leo, how do we save the end result on an excel if u want to import the result ..let me know

    • @leoschafer9142
      @leoschafer9142  3 года назад

      Hi Harkesh, thank you for your question. Do you mean export? The writexl-Package can do that. It has a function called write_xlsx(). Hope that helps!

  • @stefanlindow6160
    @stefanlindow6160 3 года назад

    Hi! I wonder, if the pipe-operator works with all the commands. I feel that this is not the case. correct? if yes, then how to know which work with it and which dont.

    • @leoschafer9142
      @leoschafer9142  3 года назад

      Hi Stefan, the pipe-operator should work for all functions.

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

    are you german?

  • @mosalah8166
    @mosalah8166 Год назад

    Pipes, makes R feel like SQL.

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

    You are making it way too difficult to explain. You started good but you made it complicated at the end.