🚗 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.

👋 Before you go, leave an anonymous rating & feedback

Average rating 5 / 5. Vote count: 17

No votes so far! Be the first to rate this post.

Please share any positive or negative feedback you may have.

Feedback is completely anonymous

3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jobert Richie

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))

Sabina

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).

Jobert Richie

Hi Sabina!
Thanks for the answer. The workshop exercise helped indeed to understand this nuance.
Thanks once again.

3
0
Questions or comments?x