10.5 Summary

ds4psy: (10) Dates and times

This was a long and difficult chapter, but not because the functions and packages of R are difficult, but rather because the domain and representation of dates and times provide substantial challenges. As we have seen, dealing with times requires knowing and navigating many cultural and local conventions, some peculiarities, and various standards. An intellectually intriguing aspect of this topic is that solving tasks with date- and time-related data requires a solid conceptual understanding of time (e.g., points vs. spans of time) and various notions of time spans (e.g., durations, periods, and intervals).

After working through this chapter, you are able to:

  1. understand the basic units of dates and times,
  2. distinguish between different time zones and notions of time spans,
  3. understand and use essential date and time classes of base R,
  4. understand and use key date and time functions of lubridate,
  5. create date and time variables from various inputs,
  6. perform basic computations with date and time variables,
  7. use simple ds4psy functions to query dates and times.

For an overview of manipulating dates and times with lubridate, take a look at the RStudio cheatsheet to check which commands you are now familiar with and which others you can still discover in the future:

Manipulate dates and times with **lubridate**<br>from [RStudio cheatsheets](https://www.rstudio.com/resources/cheatsheets/).

Figure 10.2: Manipulate dates and times with lubridate
from RStudio cheatsheets.

Let’s test our knowledge and skills on creating and manipulating dates and times by completing the following exercises.