bacen_series | R Documentation |
This function establishes a connection with the Central Bank of Brazil (BACEN) API to retrieve data in JSON format and convert it into a readable format such as a data frame or list. The connection is attempted up to 3 times in case of failure.
bacen_series(urls, httr = TRUE)
urls |
A string containing the BACEN API URL for the desired series. |
httr |
A logical value. If 'TRUE', the function uses the 'httr' package to connect. If 'FALSE', the function uses the 'httr2' package. Default is 'TRUE'. |
Returns the content of the API response converted into an R object (usually a list or data frame), or 'NULL' if the connection fails after 3 attempts.
# Example using the httr package
url <- bacen_url(c('433', '13005'), "01/01/2023", "31/12/2023") # Date format: "dd/mm/yyyy"
bacen_series(url, httr = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.