economics

US monthly economic time series (subset).

Each row is a month from 2008-01-01 to 2009-12-01. Columns:

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/:

Usage

economics

Examples

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(),
)

Table of 24 monthly rows (2008-01 to 2009-12) with six columns: date, pce, pop, psavert, uempmed, unemploy.

Table of 24 monthly rows (2008-01 to 2009-12) with six columns: date, pce, pop, psavert, uempmed, unemploy.

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,
)

Line chart of unemployed count (thousands) from January 2008 to December 2009 with a steep rise through the 2008-2009 recession peaking near 15,000 in late 2009.

Line chart of unemployed count (thousands) from January 2008 to December 2009 with a steep rise through the 2008-2009 recession peaking near 15,000 in late 2009.

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,
)

Two-line chart over 2008-2009 with personal savings rate in green rising to about 7 percent and median unemployment duration in orange rising to about 20 weeks.

Two-line chart over 2008-2009 with personal savings rate in green rising to about 7 percent and median unemployment duration in orange rising to about 20 weeks.

Back to top