View source: R/four.digit.year.R
four.digit.year | R Documentation |
Converts from two to four digit representation of years correcting the century for years earlier than that specified. Addresses the fact that under POSIX specifications, values 00 to 68 are prefixed by 20 and 69 to 99 by 19 when converting from two digit years, which can affectlonger time series and older data sets.
four.digit.year(x, year=1968)
x |
A vector of POSIXct dates, presumably with some years (often those earlier than 1969) assigned to the wrong century. |
year |
The year (in four digit format) indicating the cutoff for setting the century to 1900's or 2000's. |
A vector of same length as input with years in four digit format.
Nick Bond <n.bond@latrobe.edu.au>
strptime
.
x <- as.POSIXct(c("01/01/43","01/01/68","01/01/69","01/01/99","01/01/04"), format="%d/%m/%y") x four.digit.year(x, year=1968) four.digit.year(x, year=1942)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.