Skip to content

Commit

Permalink
Corrected bug through more precise namespace for lag function
Browse files Browse the repository at this point in the history
  • Loading branch information
dkgaraujo committed Dec 7, 2022
1 parent e6a9576 commit 045385f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions R/ifdata_backend.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ adjust_income_statement_data <- function(dataframe, all_data_info) {
.[[1]]

dataframe <- dataframe %>%
dplyr::group_by(Financial_institution, lubridate::year(Quarter)) %>%
dplyr::mutate(Year = lubridate::year(Quarter),
Month = lubridate::month(Quarter)) |>
dplyr::group_by(Financial_institution, Year) %>%
dplyr::mutate(
dplyr::across(
tidyselect::all_of(income_statement_cols),
.fns = list(income_statement_adj = ~ ifelse(lubridate::month(Quarter) %in% c(6, 12),
.x - lag(.x, order_by = Quarter),
.fns = list(income_statement_adj = ~ ifelse(Month %in% c(6, 12),
.x - dplyr::lag(.x, order_by = Quarter),
.x)),
.names = "{col}_qtr"
)
Expand Down
3 changes: 2 additions & 1 deletion data-raw/brazilian_banks_201703_202112.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ library(brazilianbanks)
brazilian_banks_201703_202112 <- get_bank_stats(yyyymm_start = 201703,
yyyymm_end = 202112,
banks_only = FALSE,
adjust_income_data = TRUE,
include_growthrate = FALSE,
cache_json = TRUE,
verbose = FALSE)
verbose = TRUE)

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

0 comments on commit 045385f

Please sign in to comment.