beaGet: Pass list of user specifications (including API key) to...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
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

1
2
3
4
5
6
7
userSpecList <- list('UserID' = 'yourAPIKey' ,
								'Method' = 'GetData',
								'datasetname' = 'NIPA',
								'Frequency' = 'A',
								'TableID' = '68',
								'Year' = 'X')	
BDT <- beaGet(userSpecList, asTable = TRUE)

Example output

Loading required package: data.table
Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis'
Warning message:
In beaGet(userSpecList, asTable = TRUE) : Invalid API key: yourAPIKey

bea.R documentation built on May 2, 2019, 1:30 p.m.

Related to beaGet in bea.R...