beaAPI: API Bureau of Economic Analysis

Description Usage Arguments Details Value Author(s) Examples

Description

Connect to BEA datasets

Usage

1
2
3
4
5
6
beaAPI(api.param = stop("'api.param' must be specified"), curl = NULL,
  query = FALSE, raw = FALSE)

beaDFtoXTS(data = stop("'data' must be provided"))

beaChangeDates(str)

Arguments

api.param

a list of parameters specific to the API

curl

optional, CURL handle created with RCurl::getCurlHandle()

query

the API query

raw

return unparsed API response

data

a data frame created with beaJSONtoDF

str

a character string with BEA dates, e.g. "2000", "2000Q1", "2000M01"

Details

These functions allow connecting to BEA time series in JSON format with a valid user ID obtained from http://www.bea.gov/API/signup/index.cfm

Value

The function creates an URL with with the specified parameters, retrieves the JSON string and transforms to R list

Author(s)

Bo Werth <bo.werth@gmail.com>

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
curl <- RCurl::getCurlHandle()
api.param <- list(USERID = "api.key",
                  METHOD = "GETDATASETLIST",
                  RESULTFORMAT = "JSON")
List <- beaAPI(api.param = api.param, curl = curl)
df <- beaJSONtoDF(List = List, third = 1)

## End(Not run)

bowerth/nsoApi documentation built on June 17, 2019, 4:55 a.m.