economics
US monthly economic time series (subset).
Each row is a month from 2008-01-01 to 2009-12-01. Columns:
date(string"YYYY-MM-DD").pce(personal consumption expenditures, billions of dollars).pop(total population, thousands).psavert(personal savings rate, percent).uempmed(median duration of unemployment, weeks).unemploy(number of unemployed, thousands).
The bundled literal is stored in column-store form; plot accepts either column-store or row-store input and normalises internally.
Source: shape and column definitions follow the economics dataset bundled with the ggplot2 R package; see help("economics") in R. Original series come from the US Federal Reserve Economic Data (FRED), https://fred.stlouisfed.org/:
pce: https://fred.stlouisfed.org/series/PCE.pop: https://fred.stlouisfed.org/series/POP.psavert: https://fred.stlouisfed.org/series/PSAVERT.uempmed: https://fred.stlouisfed.org/series/UEMPMED.unemploy: https://fred.stlouisfed.org/series/UNEMPLOY.
Usage
economicsExamples
Preview all 24 entries.
#let cols = economics.pairs()
#let cell(v) = if v == none { text(fill: gray, [_none_]) } else { [#v] }
#table(
columns: cols.len(),
align: center + horizon,
inset: 5pt,
stroke: 0.5pt,
..cols.map(p => strong(raw(p.at(0)))),
..range(cols.first().at(1).len()).map(i => cols.map(p => cell(p.at(1).at(i)))).flatten(),
)Plot the unemployment series over time using date as a continuous date axis.
#plot(
data: economics,
mapping: aes(x: "date", y: "unemploy"),
layers: (geom-line(stroke: 1pt),),
scales: (scale-x-date(),),
width: 11cm,
height: 6cm,
)Stack two layers with their own y mappings to compare two series on the same panel.
#plot(
data: economics,
mapping: aes(x: "date"),
layers: (
geom-line(mapping: aes(y: "psavert"), colour: rgb("#1b9e77"), stroke: 1pt),
geom-line(mapping: aes(y: "uempmed"), colour: rgb("#d95f02"), stroke: 1pt),
),
scales: (scale-x-date(),),
labs: labs(y: "Percent / Weeks"),
width: 11cm,
height: 6cm,
)