Description Usage Arguments Details Examples
Helper functions for manipulating and converting between regular year-month-day date strings and EIA date string notation.
1 2 3 4 5 | eiadate_to_date(x)
date_to_eiadate(x, date_format = c("A", "Q", "M", "W", "D", "H"))
eiadate_to_date_seq(start, end, weekly = FALSE)
|
x |
character, EIA date string; character or date object for regular dates. See details. |
date_format |
EIA date format: "A", "Q", "M", "W", "D", "H". These stand for annual, quarterly, monthly, weekly, daily, hourly. See details. |
start |
start EIA date or date. |
end |
end EIA date or date. |
weekly |
logical. See details. |
There is no reason to mix EIA date formats in this context. Functions that take EIA date strings expect a consistent format.
Also, EIA date formats are parsed automatically from the dates themselves.
However, daily and weekly use the same format. Too avoid ambiguity in eia_date_seq
, daily is assumed; set weekly = TRUE
to treat as weekly.
When providing a real date or date string, such as to date_to_eiadate
, dates should be in yyyy-mm-dd
format,
or at least any format that can be parsed by lubridate::ymd
or lubridate::ymd_hms
for dates and hourly date times, respectively.
"HL"
is not a supported date format. Use "H"
. The API does not
translate the date and time when using "HL"
anyhow; it simply appends
the date string with the number of hours time difference.
1 2 3 4 5 6 7 8 9 10 11 12 13 | eiadate_to_date(c("201803", "201804"))
date_to_eiadate("2018-05-14", "A")
date_to_eiadate("2018-05-14", "Q")
date_to_eiadate("2018-05-14", "M")
(x <- eiadate_to_date_seq("2018Q1", "2018Q4"))
date_to_eiadate(x, "Q")
(x <- eiadate_to_date("20190102T16Z"))
date_to_eiadate(x, "H")
(x <- eiadate_to_date_seq("20190102T16Z", "20190102T19Z"))
date_to_eiadate(x, "H")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.