Skip to content

Commit

Permalink
New version 0.0.4. Data added to pkg.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkgaraujo committed Jan 17, 2023
1 parent 045385f commit 79a97af
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cache_json
R/pillar3_backend.R
^codecov\.yml$
^data-raw$
^vignettes/articles$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ nbs
inst/doc
*.csv
*.RDS
vignettes/articles/cache_json
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: brazilianbanks
Type: Package
Title: Data on Brazilian banks and other regulated financial institutions
Version: 0.0.3
Version: 0.0.4
Author: Douglas Kiarelly Godoy de Araujo
Maintainer: Douglas Kiarelly Godoy de Araujo <dkg.araujo@gmail.com>
Description: A user-friendly interface to official datasets of bank-level variables
Expand Down
15 changes: 15 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@
#'
#' @source https://www3.bcb.gov.br/ifdata/
"brazilian_banks_201703_202112"

#' Brazilian banks and other financial institutions: 2017 Q1 onwards to the most recent quarter
#'
#' This data is updated frequently to contain the most up-to-date data. For a smaller version
#' that includes data only up to 2021 Q4, please see `brazilian_banks_201703_202112`.
#'
#' Accounting, risk and other information for banks and
#' other financial institutions in Brazil, from the
#' 'IF.data' system of the Central Bank of Brazil.
#'
#' @format ## `brazilian_banks_201703_onwards`
#' A tibble with 26,885 rows and 426 columns
#'
#' @source https://www3.bcb.gov.br/ifdata/
"brazilian_banks_201703_onwards"
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ devtools::install_github("dkgaraujo/brazilianbanks")
```

## Usage

### Bank-level information

The `brazilianbanks` package already includes off-the-shelf two datasets of banks and other financial institutions' accounting, risk and other information. One such dataset includes all information from 2017 Q1 up to the most recent quarter: `brazilian_banks_201703_onwards`. A shorter version of this dataset covers the period of 2017 Q1 to 2021 Q4: `brazilian_banks_201703_202112`.

```
library(brazilianbanks)
brazilian_banks_201703_onwards
```

Using these pre-loaded datasets is usually a quicker alternative to `get_bank_stats()`, the main function to retrieve data in a more customised way.

The function `all_available_quarters()` returns a vector with all the quarters for which there is available data. I suggest you run this function first, in particular to check what the most recent quarter is.

If you are interested in bank-level variables (eg, accounting or credit risk figures), the main function is `get_bank_stats()`. It returns a tibble data frame with the panel data:
Expand All @@ -29,7 +42,7 @@ bank_df <- get_bank_stats(yyyymm_start = 201903, yyyymm_end = max(quarters))

The initial and final quarters (arguments `yyyymm_start` and `yyyymm_end` respectively) are defined by the user according to the YYYYMM format, ie March 2014 is 201403. Note that the code chunk above uses the most recent available quarter as the final quarter for data download.

> Note that the `brazilianbanks` package already embeds a dataset variable of banks and other financial institutions' accounting, risk and other information for the period of 2017 Q1 to 2021 Q4: `brazilian_banks_201703_202112`. If you are looking to get familiar with the dataset and the time frame of this variable is suitable for you, using it is a quicker alternative to `get_bank_stats()`.
### Banking statistics at the municipality level

If your focus is on municipality-level banking statistics, the main function is `get_municipal_stats()`. It returns a tibble data frame with bank balance sheet and financial statement variables at the municipal level, at a monthly frequency:

Expand Down
10 changes: 10 additions & 0 deletions data-raw/brazilian_banks_201703_202112.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ brazilian_banks_201703_202112 <- get_bank_stats(yyyymm_start = 201703,
verbose = TRUE)

usethis::use_data(brazilian_banks_201703_202112, overwrite = TRUE)

brazilian_banks_201703_onwards <- get_bank_stats(yyyymm_start = 201703,
yyyymm_end = tail(all_available_quarters(), n = 1),
banks_only = FALSE,
adjust_income_data = TRUE,
include_growthrate = FALSE,
cache_json = TRUE,
verbose = TRUE)

usethis::use_data(brazilian_banks_201703_onwards, overwrite = TRUE)
Binary file added data/brazilian_banks_201703_onwards.rda
Binary file not shown.

0 comments on commit 79a97af

Please sign in to comment.