~/data/bea/FixedAssets.html
Info
LAST_DOWNLOAD
file
|
LAST_DOWNLOAD
|
FAAt103
|
2023-12-07
|
Layout
- Fixed Assets Website. html

Ex 1: Time Series
Private VS Public
FAAt103 %>%
year_to_date %>%
filter(LineNumber %in% c(3, 9)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_adjustment, by = "date") %>%
mutate(DataValue = 1000 * `Real GDP / Real GDP Trend (Log Linear)` * DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable, linetype = variable)) +
scale_color_manual(values = viridis(6)[1:5]) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
labels = date_format("%y"),
limits = as.Date(paste0(c(1927, 2019), "-01-01"))) +
scale_y_continuous(breaks = 0.01*seq(0, 40, 1),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.1, 0.85),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))

Main Components
FAAt103 %>%
year_to_date %>%
filter(LineNumber %in% c(5, 6, 8, 15)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_adjustment, by = "date") %>%
mutate(DataValue = 1000 * `Real GDP / Real GDP Trend (Log Linear)` * DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable, linetype = variable)) +
scale_color_manual(values = viridis(6)[1:5]) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
labels = date_format("%y"),
limits = as.Date(paste0(c(1927, 2019), "-01-01"))) +
scale_y_continuous(breaks = 0.01*seq(0, 15, 1),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.45, 0.25),
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
FAAt103 %>%
year_to_date %>%
mutate(year = year(date)) %>%
filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
group_by(year) %>%
mutate(DataValue = round(100*DataValue/DataValue[1], 1)) %>%
ungroup %>%
select(LineNumber, LineDescription, year, DataValue) %>%
spread(year, DataValue) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}
Billions
FAAt103 %>%
year_to_date %>%
mutate(year = year(date)) %>%
filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
group_by(year) %>%
mutate(DataValue = round(DataValue)) %>%
ungroup %>%
select(LineNumber, LineDescription, year, DataValue) %>%
spread(year, DataValue) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}