🚗 Video too fast or too slow? Click the gear icon ⚙️ at the bottom-right to change the speed!
Lesson code
Please download the zip folder below to code along with the instructor!
After downloading, unzip the folder, open the RStudio Project file within, then open the “VIDEO_CODE_ALONG” script and type along with the instructor in the video above!
Lesson notes
The written guide below is an accompaniment to the lesson video. You may read through it if you prefer written tutorials to video content.
In the following code, why do we add label = TRUE for month() and not for day or year?
irs_dates_1 %>%
mutate(start_date_long = mdy(start_date_long)) %>%
mutate(day = day(start_date_long),
month = month(start_date_long, label = TRUE),
year = year(start_date_long))
Hi Jobert,
The reason why we are include the label = TRUE for month only is because since we are using {lubridate} to convert it into a Date, and the default format for Dates is to include the numbers. By making the argument label = TRUE, we are indicating that we want for the date to be written as the character months (Jan, Feb, Mar…) and not the month’s number (1, 2, 3).
Hi Sabina!
Thanks for the answer. The workshop exercise helped indeed to understand this nuance.
Thanks once again.