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 .}