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)
api.param | a list of parameters specific to the API |
---|---|
curl | optional, |
query | the API query |
raw | return unparsed API response |
data | a data frame created with |
str | a character string with BEA dates, e.g. |
The function creates an URL with with the specified parameters, retrieves the JSON string and transforms to R list
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
# 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) # }