beaGet | R Documentation |
Pass list of user specifications (including API key) to return data from BEA API.
beaGet(
beaSpec,
asString = FALSE,
asList = FALSE,
asTable = TRUE,
asWide = TRUE,
isMeta = FALSE,
iTableStyle = TRUE
)
beaSpec |
A list of user specifications (required). In this example, 'GetData' specifies that we want data values (rather than metadata), 'NIPA' specifies the dataset, 'A' specifies that we want annual data, 'TableID' = '68' gets a specific table, and 'X' gets all years. See BEA API documentation or use metadata methods for complete lists of parameters. |
asString |
Return result body as a string (default: FALSE) |
asList |
Return result body as a list (default: FALSE) |
asTable |
Return result body as a data.table (default: TRUE) |
asWide |
Return data.table in wide format (default: TRUE) |
isMeta |
Special parameter meant to interact with metadata functions (default: FALSE) |
iTableStyle |
If "asWide = TRUE", setting "iTableStyle = TRUE" will return data.table in same format as shown on BEA website, with dates and attributes as column headers and series as rows; otherwise, results have series codes as column headers (default: TRUE) |
By default, an object of class 'list' of several dimensions. View list structure using 'str(yourList)'.
userSpecList <- list('UserID' = Sys.getenv("BEA_API_KEY"),
'Method' = 'GetData',
'datasetname' = 'NIPA',
'Frequency' = 'A',
'TableName' = 'T20405',
'Year' = 'X')
BDT <- beaGet(userSpecList, asTable = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.