Chapter 10 Time data

ds4psy: (10) Time data

Please note: This chapter is a fragment — most of it is yet to be written.

This chapter will eventually contain essential commands for entering and manipulating dates and times in R. See also Chapter 16: Dates and times of the r4ds textbook (Wickham & Grolemund, 2017) and corresponding examples and exercises.

Time data: Using dates and time data with **lubridate**.

Figure 10.1: Time data: Using dates and time data with lubridate.

Computing with dates and times is surprisingly complicated, as it inevitably involves many different units, locations, languages,
as well as cultural differences (like time zones, time shifts). Dealing with all this messy human stuff requires standardization and requires conceptual sophistication (like distinguishing between durations and intervals).

This chapter will show the basics of dealing with dates and times in R. Key contents include:

  • Entering times and the Date class, time zones, and formatting strings in base R;

  • key commands of the lubridate package (Spinu, Grolemund, & Wickham, 2018) for computing with dates and times;

  • simple commands for quering dates and times (provided by the ds4psy package).

Note relations to other chapters (see Chapter 11) and book parts.

References

Spinu, V., Grolemund, G., & Wickham, H. (2018). lubridate: Make dealing with dates a little easier. Retrieved from https://CRAN.R-project.org/package=lubridate

Wickham, H., & Grolemund, G. (2017). R for data science: Import, tidy, transform, visualize, and model data. Retrieved from http://r4ds.had.co.nz