Table 3.3ESI. Historical-Cost Net Stock of Private Fixed Assets by Industry (A) - FAAt303ESI

Data - BEA

Layout

  • Fixed Assets Website. html

Ex 1: Private fixed assets

By sector

Code
FAAt303ESI %>%
  filter(Line %in% c(1, 55, 11)) %>%
  rename(variable = LineDescription) %>%
  left_join(gdp_adjustment, by = "date") %>%
  mutate(value = 1000*value/ GDP) %>%
  ggplot + geom_line(aes(x = date, y = value, color = variable, linetype = variable)) + 
  ylab("% of GDP") + xlab("") + 
  theme_minimal()+
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1948-01-01")),
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) +
  scale_x_date(breaks = nber_recessions$Peak,
               minor_breaks = "5 years",
               labels = date_format("%Y")) + 
  scale_y_continuous(breaks = 0.01*seq(0, 500, 20),
                     labels = scales::percent_format(accuracy = 1)) +
  scale_color_manual(values = viridis(5)[1:4]) +
  theme(legend.position = c(0.2, 0.9),
        legend.title = element_blank(),
        legend.text = element_text(size = 8),
        legend.key.size = unit(0.9, 'lines'))

Agriculture, Mining, Utilities

Code
FAAt303ESI %>%
  filter(Line %in% c(2, 5, 9)) %>%
  rename(variable = LineDescription) %>%
  left_join(gdp_adjustment, by = "date") %>%
  mutate(value = 1000*value/ GDP) %>%
  ggplot + geom_line(aes(x = date, y = value, color = variable, linetype = variable)) + 
  ylab("% of GDP") + xlab("") + 
  theme_minimal()+
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1948-01-01")),
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) +
  scale_x_date(breaks = nber_recessions$Peak,
               minor_breaks = "5 years",
               labels = date_format("%Y")) + 
  scale_y_continuous(breaks = 0.01*seq(0, 500, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  scale_color_manual(values = viridis(5)[1:4]) +
  theme(legend.position = c(0.2, 0.9),
        legend.title = element_blank(),
        legend.text = element_text(size = 8),
        legend.key.size = unit(0.9, 'lines'))

Agriculture, Mining, Wholesale

Code
FAAt303ESI %>%
  filter(Line %in% c(10, 11, 33)) %>%
  rename(variable = LineDescription) %>%
  left_join(gdp_adjustment, by = "date") %>%
  mutate(value = 1000*value/ GDP) %>%
  ggplot + geom_line(aes(x = date, y = value, color = variable, linetype = variable)) + 
  ylab("% of GDP") + xlab("") + 
  theme_minimal()+
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1948-01-01")),
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) +
  scale_x_date(breaks = nber_recessions$Peak,
               minor_breaks = "5 years",
               labels = date_format("%Y")) + 
  scale_y_continuous(breaks = 0.01*seq(0, 500, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  scale_color_manual(values = viridis(5)[1:4]) +
  theme(legend.position = c(0.2, 0.9),
        legend.title = element_blank(),
        legend.text = element_text(size = 8),
        legend.key.size = unit(0.9, 'lines'))

Ex 2: 1938, 1958, 1978, 1998, 2018 Table

Percent

Code
FAAt303ESI %>%
  mutate(year = year(date)) %>%
  filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
  group_by(year) %>%
  mutate(value = round(100*value/value[1], 1)) %>%
  ungroup %>%
  select(Line, LineDescription, year, value) %>%
  spread(year, value) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Billions

Code
FAAt303ESI %>%
  mutate(year = year(date)) %>%
  filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
  group_by(year) %>%
  mutate(value = round(value)) %>%
  ungroup %>%
  select(Line, LineDescription, year, value) %>%
  spread(year, value) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}