Description Usage Arguments Details Value See Also Examples
View source: R/format_period.R
Given a vector of period labels, create a
factor
that contains
levels for the earliest and latest periods in x
,
and for all periods in between.
1 |
x |
A vector of period labels. |
Quarters are defined as follows:
Quarter | Start | End |
Q1 | 1 January | 31 March |
Q2 | 1 April | 30 June |
Q3 | 1 July | 30 September |
Q4 | 1 October | 31 December |
The elements of x
must all be single quarters,
eg "2001 Q2"
or "2055 Q1"
.
Open intervals such as "<2001 Q2"
are not
allowed.
If x
contains NA
, then the
levels of the factor created by format_period_quarter
also contain NA
.
A factor with the same length as
x
.
Other functions for reformating period labels are
format_period_year
format_period_multi
format_period_custom
format_period_month
date_to_period_quarter
creates
quarter periods from dates.
1 | format_period_quarter(x = c("2000 Q4", "2005 Q1", NA, "2004 Q3"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.