Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Dates
Summary

Instruction

Another nice thing about lubridate is that we can simply extract specific information, like months or days, from a date. To extract the month, we use the month() function:

trucks$departure_month <- month(trucks$departure_date)

There are similar functions: year(), quarter(), week(), hour(), minute(), ... and many more which you may see at the lubridate reference page. Add it to your bookmarks, it'll come in handy when you'll be working with date & time in the future.

Exercise

Using the month() function, get the month of departure in the ships data set and save it into a new column: departure_month.