Programming with dplyr and the tidyverse, Part 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good afternoon so yesterday i had some technical issues so the end of my previous video was not recorded and i didn't notice um and you didn't notice either because most of you stopped watching after three minutes so no no harm dones i was talking about the dots so i just want to go back to that and just discuss a little bit more um this programming techniques with dplyer so the dots what they allow you to do is as the program of the function not having to uh think or you know predefined the number of arguments that you want your users to use um that this is the dots is our general concept they this isn't has nothing to do with the tidy verse or deploy or whatever this is an art thing so um basically what you can do uh is you can say well i don't know what my users want i don't know how many variables they want to count so instead of for forcing one or two or three or whatever i just put the dots the dots get captured with quotes and they get evaluated with three exclamation points so here below i have two arguments i have three arguments i have four arguments it works okay so you could add five six whatever you want so this is pretty pretty useful now um some of you also talked about the curly braces that you see here so the curly braces are more recent okay a more recent addition into this tie diverse way of programming functions let's say and i don't use them as much mostly because out of habits i'm so used to this uh enco bang bang quotes triple bang etc a workflow that i don't think about using the double curly braces and they make it easier because you don't need so you just need to write this curly brace double curly braces and the name of your variable or rather in this case variable and you don't need the enco bang bang workflow okay however um so i'm as i said i don't use them as much so you might want to check the documentation but they seem to be less flexible so i just tried it before filming with the dots and it doesn't work so maybe there is a way to use the dots with the double curly braces i don't know um i wrote a blog post that i also linked in the description of the previous video that i will link here again that talks about this double curly braces and but that was maybe two years ago now so um i mean it probably changed a lot since then so you might want to read the blog post but then read the documentation maybe the dots i don't know maybe it's a triple curly braces or whatever so maybe you want to um yeah to just check that now and the other thing i want to show you is a more complex function just to yeah just to show you how you could use this in a more realistic use case where you have for example two variables so one variable uh by which you will group so you're just using quo here again another variable by which you filter so you ain't using quo here again and then just the condition and for your filter so you just use it as as usual so there's really not much um to say you have two variables well you just end quote all of them and then you just use the bang bang to just call them you could of course also this should also work use two curly braces so let's try it out so instead of writing this i could uh also just so i'm going to try a uh an advanced vim trick so let's see if i can do it live so it's already it's it's already not starting very well so okay and then no then i do k and this oh i wanted to like not have to write the whole curly thing so it should be with k and then oh it worked but only once yeah so you can like um [Music] so you can like select around the world the word the word and then if you press k and then you press what you need you have the you know you have the the thing coming but i just you know wasted more time than if i did it manually so this is the problem with vim sometimes well this is not vm it's space max but it's vim mode and is that sometimes you want to do some very neat tricks and you waste more time than that if you just do it manually anyway let's see if this works this should work um this should work but let's try if not well too bad but yeah it's it's working um yeah it's it's working just like before so you can also use the uh curly braces if you have more than one variable so i won't discuss how you can programmatically because you can programmatically also rename the um the the columns that you mutate or that you summarize etc and this is explained in the in the blog posts and again those blog posts are starting to be old so maybe read the documentation because i think there's been a lot of updates that you might want to check out anyway so this was really just to discuss the dots and to um show you this double curly braces that were mentioned in the comments of the previous video i don't use them as much but they might be i mean they might be worth your time if you read the documentation it's a bit easier it's also maybe easier if you're trying to explain this concept to uh and some person that doesn't use r so much so you just you can just say well you know you have this curly braces and i think that might be easier than this enco bang bang thing which is a bit abstract even for me even though i use it i'm like not entirely sure of what's exactly going on under the hood but it works so that's all that matters anyway um as i said before uh if you in the previous video if you enjoy these videos consider subscribing i'm preparing some a very interesting video to celebrate 500 subscribers which should happen soonish and and i also will i will also link in the description below a survey that i've been running for the past couple of days about typing speeds and keyboard layouts so um it takes you two minutes so if you have some time please fill it out that'd be great thank you very much and enjoy your weekend
Info
Channel: Bruno Rodrigues
Views: 328
Rating: 5 out of 5
Keywords:
Id: pcvWKVlRmwE
Channel Id: undefined
Length: 6min 56sec (416 seconds)
Published: Sat Mar 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.