Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

upkeep: squelch warning in test-aggregate_alignment_loanbook_exposure.R #21

Closed
cjyetman opened this issue Mar 13, 2024 · 0 comments · Fixed by #34
Closed

upkeep: squelch warning in test-aggregate_alignment_loanbook_exposure.R #21

cjyetman opened this issue Mar 13, 2024 · 0 comments · Fixed by #34
Labels
upkeep maintenance, infrastructure, and similar

Comments

@cjyetman
Copy link
Member

When I run tests locally, I get the following warning

Warning (test-aggregate_alignment_loanbook_exposure.R:41:1): (code run outside of `test_that()`)
Using an external vector in selections was deprecated in tidyselect 1.1.0.
ℹ Please use `all_of()` or `any_of()` instead.
  # Was:
  data %>% select(group_vars)

  # Now:
  data %>% select(all_of(group_vars))

See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Backtrace:

  1. ├─test_data_aggregate_alignment_loanbook_exposure_net %>% ... at test-aggregate_alignment_loanbook_exposure.R:41:1
  2. ├─pacta.multi.loanbook.analysis::aggregate_alignment_loanbook_exposure(...)
  3. │ └─... %>% ... at pacta.multi.loanbook.analysis/R/aggregate_alignment_loanbook_exposure.R:132:3
  4. ├─dplyr::arrange(...)
  5. ├─dplyr::relocate(...)
  6. └─dplyr:::relocate.data.frame(...)
  7.   └─dplyr:::eval_relocate(...)
  8.     └─tidyselect::eval_select(...)
  9.       └─tidyselect:::eval_select_impl(...)
 10.         ├─tidyselect:::with_subscript_errors(...)
 11.         │ └─rlang::try_fetch(...)
 12.         │   └─base::withCallingHandlers(...)
 13.         └─tidyselect:::vars_select_eval(...)
 14.           └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
 15.             └─tidyselect:::eval_c(expr, data_mask, context_mask)
 16.               └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 17.                 └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
 18.                   └─tidyselect:::eval_c(expr, data_mask, context_mask)
 19.                     └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 20.                       └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
 21.                         └─tidyselect:::eval_sym(expr, data_mask, context_mask)

changing this:

dplyr::relocate(
c(
group_vars, "n_companies", "n_companies_aligned",
"share_companies_aligned", "exposure_weighted_net_alignment"
)
) %>%

to this:

    dplyr::relocate(
      dplyr::all_of(
        c(
          group_vars, "n_companies", "n_companies_aligned",
          "share_companies_aligned", "exposure_weighted_net_alignment"
        )
      )
    ) %>%

squelches the warning

@jacobvjk jacobvjk added the upkeep maintenance, infrastructure, and similar label Apr 17, 2024
@jacobvjk jacobvjk changed the title squelch warning in test-aggregate_alignment_loanbook_exposure.R upkeep: squelch warning in test-aggregate_alignment_loanbook_exposure.R Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants