GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

[BUG]: render_cell_suppression.default sometimes don't work #92

Closed shijiaSMH closed 5 months ago

shijiaSMH commented 5 months ago

Affected function:

render_cell_suppression.default()

I'll edit w a reproduceable example when I have capacity. The bug happened all of a sudden without any code changes.

Broadly speaking, I think the cause is indirect use of vctrs::vec_as_subscript() from tidyverse or dpyr. Reinstallation of vctrs didn't work.

Error message

 > table1(strata, labels, groupspan=c(1, 1, 2), 
+   continuous_fn='median', render = Rgemini::render_cell_suppression.default)
Error in `vctrs::vec_as_subscript()`:
! `...` must be empty.
x Problematic argument:
* call = call
Run `rlang::last_error()` to see where the error occurred.

> rlang::last_error()
<error/rlib_error_dots_nonempty>
Error in `vctrs::vec_as_subscript()`:
! `...` must be empty.
x Problematic argument:
* call = call
---
Backtrace:
  1. table1::table1(...)
 15. dplyr:::select.data.frame(., frequency)
 16. tidyselect::eval_select(expr(c(...)), .data)
 17. tidyselect:::eval_select_impl(...)
 20. tidyselect:::vars_select_eval(...)
 21. tidyselect:::walk_data_tree(expr, data_mask, context_mask)
 22. tidyselect:::eval_c(expr, data_mask, context_mask)
 23. tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 24. tidyselect:::walk_data_tree(init, data_mask, context_mask)
 25. tidyselect:::as_indices_sel_impl(...)
 26. tidyselect:::as_indices_impl(...)
 27. vctrs::vec_as_subscript(x, logical = "error", call = call, arg = arg)
Run `rlang::last_trace()` to see the full context.
shijiaSMH commented 5 months ago

To follow up, this is not a bug about table1 wrapper, the cause are old versions of dplyr and vctrs. This bug is solved after updating to dplyr 1.1.3 and vctrs 0.6.3. Thus, I suggest to close this issue.

Note that this error message was also shown when running disability and icd_to_ccsr. I believe it's because those Rgemini functions required dplyr and vctrs. Thus, we can consider adding a warning message for those types of Rgemini functions whenever the above bug appears, eg. 'Consider updating dplyr and vctrs' to better direct users to solutions.