November 2016
Beginner to intermediate
959 pages
43h 46m
English
The base R package provides date functionality. This grab-bag recipe shows you several date-related operations in R. R internally represents dates as the number of days from 1 January, 1970.
In this recipe, we will only be using features from the base package and not from any external data. Therefore, you do not need to perform any preparatory steps.
Internally, R represents dates as the number of days from 1 January, 1970:
> Sys.Date()
> # Supply year as two digits > # Note correspondence between separators in the date string and the format string > as.Date("1/1/80", format = "%m/%d/%y") [1] "1980-01-01" > # Supply year as 4 digits ...Read now
Unlock full access