Most of the time when we load in CSV or Excel files, we expect that the variables will be the types we expect them to be. Number columns to be numbers, and dates to be dates.
But if we actually want to take advantage of all of the great functionality of the lubridate package that helps us work with dates in R, we need to use a different format.
While R will consider our date strings to just be a character, we can easily convert the column into a proper Date format that will behave more how we'd expect it to.
In this video, I show you a brief demonstration of the power of the lubridate package and how we can use a few handy functions to convert dates in almost any format into an actual, proper, date column.
At the end, I show you how we can put it all together in a clean chunk of code using dplyr and the piping functionality that comes with it. That will not only make our lives easier when coding it (no more pesky dollar signs to access variables), but will also make our code very readable if we need to come back to it months down the road.
Ещё видео!