Skip to contents

Retrieves a data frame of available values for a specified parameter within a given Bureau of Economic Analysis (BEA) dataset.

Usage

beaParamValues(
  DatasetName = "",
  ParameterName = "",
  ResultFormat = "json",
  beaKey = NULL
)

Arguments

DatasetName

character. The name of the BEA dataset to query.

ParameterName

character. The name of the parameter for which to retrieve values.

ResultFormat

character. The format of the API response. Currently only "json" is supported. Default is "json".

beaKey

character. Optional. The BEA API key. If NULL (default), it will be retrieved using `getbeaKey()`.

Value

A data frame containing available values for the specified parameter in the given dataset. If an error occurs, it returns a data frame with error information.

Details

This function interacts with the BEA API to fetch parameter values for a specified dataset. It requires a valid BEA API key, which can be set using the `setbeaKey()` function or provided directly as an argument.

See also

setbeaKey for setting the BEA API key getbeaKey for retrieving the stored BEA API key beaParamList for getting a list of available parameters for a dataset

Examples

# Get table names for the Regional dataset
beaParamValues(DatasetName = "Regional", ParameterName = "TableName")
#> Error in if (nchar(beaKey) != 36) {    warning(paste0("Invalid API Key: ", beaKey, " Register <https://apps.bea.gov/API/signup/> Store with `setbeaKey`"))    return(paste0("Invalid API Key: ", beaKey, " Register <https://apps.bea.gov/API/signup/> Store with `setbeaKey`"))}: argument is of length zero

# Get available FIPS codes for the Regional dataset
beaParamValues(DatasetName = "Regional", ParameterName = "GeoFips")
#> Error in if (nchar(beaKey) != 36) {    warning(paste0("Invalid API Key: ", beaKey, " Register <https://apps.bea.gov/API/signup/> Store with `setbeaKey`"))    return(paste0("Invalid API Key: ", beaKey, " Register <https://apps.bea.gov/API/signup/> Store with `setbeaKey`"))}: argument is of length zero