View source: R/get_normative_data.R
| get_normative_data | R Documentation |
Queries the Bacen normative search API, collects all results within the provided date range and returns a data.frame with the records. Data are downloaded from https://www.bcb.gov.br/estabilidadefinanceira/buscanormas.
get_normative_data(terms, ini_date, end_date)
terms |
Character vector. Search terms; they will be concatenated with " OR " and URL-encoded. |
ini_date |
Character. Start date in "YYYY-MM-DD" format. |
end_date |
Character. End date in "YYYY-MM-DD" format. |
Builds the query URL using the terms and the date range.
Retrieves the total number of results to determine the page size.
Iterates over result pages (incrementing by 500) until a page returns fewer than 13 rows (stop condition).
Performs simple cleaning on returned fields:
removes "string;#" prefixes,
removes HTML tags in summaries and subjects,
removes the decimal part of normative numbers.
data.frame containing the records returned by the API and the post-processed columns. Returns an empty data.frame if the server is unavailable or no internet connection.
## Not run:
ini_date <- "2025-01-01"
end_date <- "2025-01-05"
terms <- c("Cooperativas", "Cooperativa")
normas <- get_normative_data(terms, ini_date, end_date)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.