Connect to BEA datasets

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"

Value

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

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

Examples

# 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)
# }