| codes | R Documentation |
Conversion between period specification and codes
period2code(periods) code2period(code)
periods |
period specification |
code |
period code |
Periods are specified using keywords "day", "month", "year" preceded by an integer and a space and optionally followed by "s" (the specification is further passed to cut.Date, see cut.Date for details). To fit in figures and for simplicity, periods can be also specified by codes, i.e. by D, M, Y (for "day", "month" and "year", respectively) and folowed by integer specifying the number of intervals. The functions period2code and code2period provide conversion between the two alternatives.
period2code(c('1 day', '23 days', '3 month', '2 years'))
code2period(c('D1', 'D23', 'M3', 'Y2'))