Day 14: Count how many 'taubas' are in Tauba Tauba 😭
There are some things in life that are worth counting
The number of Pringles in a can
The number of revs when driving a Ferrari
The number of times a puppy jumps when it sees you
This is worth the manual effort.
There are a few things not worth counting (personally speaking) but...
Given the recent hype around a specific song (if you follow Bollywood) going by the name 'Tauba Tauba' I realised that the song, half of it, has the same word.
How many times?
64...
sigh
Mastery 🤷🏻♂️
anyway...
What I'm getting at is this:
You're going to encounter data where variables occur much more than 64 times (and that's not worth counting manually either)
Take the flights data set for instance
flights |>
distinct(origin, dest)
This gives you the unique pairing of 'origin' and 'destination' but...
what if you wanted to get a count of the number of times this occurred?
In other words, How many times did a trip have this combination?
That's where the count function comes in
flights |>
count(origin, dest, sort = TRUE)
The sort = true simply arranges the occurrences in descending order
That's it for today
Tomorrow? We'll summarise what we learned over the week.
The functions we've used, while simple, are important as a package and come in handy for multiple data manipulation scenarios.