beaGet {bea.R}R Documentation

Pass list of user specifications (including API key) to return data from BEA API.

Description

Pass list of user specifications (including API key) to return data from BEA API.

Usage

beaGet(beaSpec, asString = FALSE, asList = FALSE, asTable = TRUE,
  asWide = TRUE, isMeta = FALSE, iTableStyle = TRUE)

Arguments

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)

Value

By default, an object of class 'list' of several dimensions. View list structure using 'str(yourList)'.

Examples

userSpecList <- list('UserID' = 'yourAPIKey' ,
								'Method' = 'GetData',
								'datasetname' = 'NIPA',
								'Frequency' = 'A',
								'TableID' = '68',
								'Year' = 'X')	
BDT <- beaGet(userSpecList, asTable = TRUE)

[Package bea.R version 1.0.6 Index]