expand_date | R Documentation |
This function expands a date column and generates additional temporal identifiers from it (such as the year, month, quarter, fiscal year etc.).
expand_date( x, gen = c("Year", "Quarter", "FY", "QFY", "Month"), origin = "1899-12-30", keep.date = TRUE, remove.missing.date = TRUE, sort = TRUE, as.factor = TRUE, ... )
x |
either a vector of class 'Date', or coercible to date using |
gen |
character. A vector of identifiers to generate from |
origin |
character / Date. Passed to |
keep.date |
logical. |
remove.missing.date |
logical. |
sort |
logical. |
as.factor |
|
... |
not used. |
A data.table
containing the computed identifiers as columns. See Examples.
make_date
, ugatsdb
# First a basic example x <- seq.Date(as.Date("1999-01-01"), as.Date("2000-01-01"), by = "month") expand_date(x) expand_date(x, gen = c("Year", "Month"), keep.date = FALSE) # Now using the API expand_date(get_data("BOU_CPI")) # Getting Monthly CPI data from the Bank of Uganda # Same thing get_data("BOU_CPI", expand.date = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.