- 3 Minutes Wednesdays
- Posts
- Free Deep-Dive Tutorial and the Last Day to Use the Promo Code
Free Deep-Dive Tutorial and the Last Day to Use the Promo Code
Guten Tag! đź‘‹
Many greetings from Munich, Germany. I have this one rule: “When I advertise for my paid courses, I have to make sure that there’s free learnings for people who don’t want to or can’t buy the course yet.”
Unfortunately, my last e-mail didn’t fit my standards. It had too little specific code that readers could benefit from. So today, during the last day where you can still use the “FRIDAY20” coupon to get 20%-off for all my courses, I’m giving you an extensive tutorial that
takes you from Excel file
in no time. So let’s dive in.
Loading data into R
Today’s data is a fake data set that I’ve generated with fakery.dev. Let’s have a look at that Excel file.
With the {openxlsx}
package, we can read the Excel file into R. Unfortunately, {openxlsx}
works with data.frames but I like tibbles more so we’ll convert it immediately after loading.
Clean up names
Those column names are terrible. I prefer all lower caps and underscores between words. We can easily achieve that with the {janitor}
package.
Convert texts to dates
Look at those dates! If you look closely, you’ll realize that they are not actually encoded as datetimes
but instead are characters
. That’s super annoying to work with. But the {lubridate}
package has fantastic functions to convert texts to dates.
Extract days of the week
With that, another {lubridate}
function lets us easily turn those dates into a week day.
Extract transaction types
By combining regular expressions and str_match()
we can also process the type of transaction.
And by using title-case on our new column and removing superfluous columns, we now have a nice data set that we can visualize.
Showing the distributions
Now, let’s focus on the distribution of deposits and withdrawals. With stat_halfeye()
we can quickly generate a chart that shows that.
Themes and labels
With basic theme changes and some meaningful labels we can make the chart much nicer.
Some more theme changes
Now, let’s get rid of the color legend and let’s also apply some small tweaks to the theme of the chart. All of that can be done in the theme()
layer.
Use meaningful axes labels
Finally, it might be nice to reflect dollar amounts on the x-axis. We can easily achieve that with the {scales}
package and the scale_x_continuous()
layer.
And with that, we have a nice lookin’ chart which would probably show some nice trends if the data were not completely made up.
I hope you enjoyed this little tutorial. Of course, this was a whirlwind tutorial that goes over many techniques quickly. In my courses, I do things a lot more carefully. But I hate praising my own content, so I’ll just let this lovely feedback I’ve received this week do that:
[…] What I appreciate most is your pedagogical approach. Each lesson builds logically on the previous ones while introducing fresh perspectives, making complex concepts easier to grasp. Lesson 27, in particular, stood out to me as an excellent example for future educators: it seamlessly integrates prior knowledge from the first 26 lessons while introducing new, thought-provoking concepts. The chain letter example is especially memorable—I know I’ll revisit it often.
Thank you for the hard work and dedication you’ve poured into creating this exceptional course. It’s clear you’ve put great care into making these lessons both practical and engaging, and it’s had a meaningful impact on my skills and confidence.
Now, if you’re interested in leveling up your skills, you can still use the promo code “FRIDAY20” to get 20-off all courses. You can find them here:
Best,
Albert
Reply