36 LEC: Working with Dates

You can follow along with the slides here if you would like to open them full-screen.

Dates are a special type of data that have their own set of functions and methods for working with them. In R, the lubridate package is a popular tool for working with dates and times. It provides a set of functions for parsing, manipulating, and formatting dates and times. For example, you can use the ymd() function to parse a date in the format “year-month-day”:

library(lubridate)
date <- ymd("2024-06-01")
date
#> [1] "2024-06-01"