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...
This was very helpful. Thank you!
This is the most clear and simple explanation about the operator .. thank you
Best video on pipe operator. Thanks a lot Leo😇
This might be the best explanation for 'pipe' on YT. Thanks a lot.
Love the short , objective format. Great work !
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!
Thanks, clear and concise!
Thank you, been confused on this for a while :)
Excellent video, thank you so much!
This video made it so easy to understand the Pipe-Operator. YOU ROCK!
Great video, very comprehensible
stay motivated this was my first video from you and liked it...keep it up
Great illustration
thanks very much! really helped me out.
your english is so clear and easy to understand.
big shoout out from Brazil
A recommendation, don’t stop! Make more immediately!
I would like to but I can't find the time at the moment. Hopefully I can produce more content soon.
nice one leo. am loving it
Keep up the great work. Subscribed!
THANK YOU ,it's very clear !!!! Looking forward to more of your works!
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.
Thank you so much, your explanation was clear and simple
thank you leo. its very helpful
Nice, Please do post more videos if you can. You are helping many others like me learn a lot outside the classroom.
Just what I needed 👍
Excellent explanation of what is the pipe operator and why it is useful. It helped me a lot. Thanks so much!!
thank you..really needed it...
Thank you so much your great explanation.it is very helpful .
Very straight-forward, very helpful
Very helpful! Thank you!
Thank you! Simple and to the point. Very informative.
thank you so much it was very overwhelming
Thank you. It was helpful.
great video! I finally got my %>% working! Thanks a lot!
Awesome video! Thanks man.
I was wondering what the symbol %>% means. You sum it up pretty awesome and very easy to understand too. Subscribed, thanks!
I started to understand better with this video. Congrats
Thank you, very clear😊
Thank you a lot. Your explanation is pretty clear!
Glad it helped!
it was really helpful. Am new in learning R so i will need more of these videos so i get better
very straightforward explanation. GJ.
So well explined!
Helpful 🙂
Wonderful!
Clear and tidy.
Thank you! 🙏
good explanation!
Thanks! It was very clear and helpul!
Excelent! Thanks!
Amazing!
Thank you!
Thanks!
Thank you sir
Thank you
I love learning from a man who speaks english.
very useful
Thank you sir, was a really clear explaination. ✌🏻
Thanks ❤
excellent
Thanks! this was awesome
thank you.
Thanks so much, you are the best.
Great video, would love to see more simple tidyverse tricks!
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.
@Gus Ulises instablaster :)
@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.
@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 !
@Gus Ulises You are welcome :D
Спасибо дружище!
Мне трудно читать документацию на английском, а твоё видео прямо помогло :)
Thumbs up, thanks so much!
Perfect!
Great video. Please, what RStudio theme did you use here?
I mean So well explained thank you
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?
Please make more 🙏🙏🙏
Great explanation!
One question though, what would the final example look like without the usage of the pipe operator?
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 :)
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
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!
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?
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
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.
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.
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 :)
@@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.
@@lisaamante5384 Super, glad you got it worked out!
Leo, how do we save the end result on an excel if u want to import the result ..let me know
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!
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.
Hi Stefan, the pipe-operator should work for all functions.
are you german?
Pipes, makes R feel like SQL.
You are making it way too difficult to explain. You started good but you made it complicated at the end.