National Income and Product Accounts - NIPA

Data - BEA


List of Main Tables

Code
paste0("https://apps.bea.gov/api/data/?&",
       "UserID=", bea_key, "&",
       "method=GetParameterValues&",
       "datasetname=NIPA&",
       "ParameterName=TableName&") %>%
  fromJSON(.) %>%
  pluck("BEAAPI", "Results", "ParamValue") %>%
  select(TableName, Description) %>%
  mutate(N = 1:n()) %>%
  filter(TableName %in% (list.files(pattern = "\\.qmd$") %>% gsub(".qmd$", "", .))) %>%
  mutate(Download = as.Date(file.info(paste0("~/Library/Mobile\ Documents/com~apple~CloudDocs/website/data/bea/", TableName, ".RData"))$mtime)) %>%
  mutate(Download = paste0('<a  target=_blank href=https://apps.bea.gov/iTable/iTable.cfm?reqid=19&step=3&isuri=1&nipa_table_list=', N, '&categories=survey >', Download ,'</a>')) %>%
  mutate(Compile = as.Date(file.info(paste0("~/Library/Mobile\ Documents/com~apple~CloudDocs/website/data/bea/", TableName, ".html"))$mtime)) %>%
  mutate(Compile = paste0('<a  target=_blank href=', TableName, '.html >', Compile, '</a>')) %>%
  select(-N) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

List of Other Tables

Code
paste0("https://apps.bea.gov/api/data/?&",
       "UserID=", bea_key, "&",
       "method=GetParameterValues&",
       "datasetname=NIPA&",
       "ParameterName=TableName&") %>%
  fromJSON(.) %>%
  pluck("BEAAPI", "Results", "ParamValue") %>%
  select(TableName, Description) %>%
  mutate(N = 1:n()) %>%
  filter(!(TableName %in% (list.files(pattern = "\\.qmd$") %>% gsub(".qmd$", "", .)))) %>%
  mutate(bea = paste0('<a  target=_blank href=https://apps.bea.gov/iTable/iTable.cfm?reqid=19&step=3&isuri=1&nipa_table_list=', N, '&categories=survey > bea </a>')) %>%
  select(-N) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

List of Parameters

Code
paste0("https://apps.bea.gov/api/data/?&",
       "UserID=", bea_key, "&",
       "method=GetParameterList&",
       "DataSetName=NIPA&") %>%
  fromJSON(.) %>%
  pluck("BEAAPI", "Results", "Parameter") %>% 
  select(ParameterName, ParameterDataType, ParameterDescription) %>%
  {if (is_html_output()) print_table(.) else .}
ParameterName ParameterDataType ParameterDescription
Frequency string A - Annual, Q-Quarterly, M-Monthly
ShowMillions string A flag indicating that million-dollar data should be returned.
TableID integer The standard NIPA table identifier
TableName string The new NIPA table identifier
Year integer List of year(s) of data to retrieve (X for All)

Real GDP

All

Code
ig_d("bea", "T10106", "us-log-real-gdp-nipa-Q")

2005-

Code
ig_d("bea", "T10106", "us-log-real-gdp-nipa-Q-2005")

Net Exports

All

Code
ig_d("bea", "T10105", "us-net-exports")