Session Ready
Exercise

Selecting the right parsing function

lubridate provides a set of functions for parsing dates of a known order. For example, ymd() will parse dates with year first, followed by month and then day. The parsing is flexible, for example, it will parse the m whether it is numeric (e.g. 9 or 09), a full month name (e.g. September), or an abbreviated month name (e.g. Sep).

All the functions with y, m and d in any order exist. If your dates have times as well, you can use the functions that start with ymd, dmy, mdy or ydm and are followed by any of _h, _hm or _hms.

To see all the functions available look at ymd() for dates and ymd_hms() for datetimes.

Here are some challenges. In each case we've provided a date, your job is to choose the correct function to parse it.

Instructions
100 XP

For each date the ISO 8601 format is displayed as a comment after it, to help you check your work

  • Choose the correct function to parse x.
  • Choose the correct function to parse y.
  • Choose the correct function to parse z.