R4EPI / epitabulate

Tables for epidemiological analysis
https://R4EPI.github.io/epitabulate
GNU General Public License v3.0
8 stars 0 forks source link

{vctrs} maintenance #15

Closed zkamvar closed 4 years ago

zkamvar commented 4 years ago

There are errors related to an updated {dplyr} or {srvyr}:

Loading epibuffet
Testing epibuffet
✔ |  OK F W S | Context
✔ |  34       | descriptive table tests [0.9 s]
✖ |  33 1     | tab_funs [4.4 s]
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
test-tab_funs.R:271: error: survey---adding strata works
Problem with `mutate()` input `__tmp__1597021085`.
✖ Input `__tmp__1597021085` can't be recycled to size 12.
ℹ Input `__tmp__1597021085` is `forcats::fct_inorder(dplyr::pull(y, `__tmp__1597021085`))`.
ℹ Input `__tmp__1597021085` must be size 12 or 1, not 24.
ℹ The error occurred in group 1: CHOICE_001 = "".
Backtrace:
  1. epibuffet::tab_survey(...) tests/testthat/test-tab_funs.R:271:2
 15. dplyr:::stop_mutate_recycle_incompatible_size(e, index = i, dots = dots)
 16. dplyr:::stop_dplyr(...)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ |  56       | univariate tests [0.7 s]
✔ |  68       | Missing data in ratios [0.8 s]
✖ |  40 2 1   | tabulate_survey [5.2 s]
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
test-tabulate_survey.R:167: error: tabulate_survey will throw an error if the stratification is not correct
Problem with `mutate()` input `__tmp__1597021092`.
✖ Input `__tmp__1597021092` can't be recycled to size 8.
ℹ Input `__tmp__1597021092` is `forcats::fct_inorder(dplyr::pull(y, `__tmp__1597021092`))`.
ℹ Input `__tmp__1597021092` must be size 8 or 1, not 16.
ℹ The error occurred in group 1: yr.rnd = "No".
Backtrace:
  1. testthat::expect_is(tabulate_survey(s, yr.rnd, awards), "tbl_df") tests/testthat/test-tabulate_survey.R:167:2
 16. dplyr:::stop_mutate_recycle_incompatible_size(e, index = i, dots = dots)
 17. dplyr:::stop_dplyr(...)

test-tabulate_survey.R:286: error: values are sensible in a transposition
Problem with `mutate()` input `__tmp__1597021094`.
✖ Input `__tmp__1597021094` can't be recycled to size 15.
ℹ Input `__tmp__1597021094` is `forcats::fct_inorder(dplyr::pull(y, `__tmp__1597021094`))`.
ℹ Input `__tmp__1597021094` must be size 15 or 1, not 30.
ℹ The error occurred in group 1: awards = "No".
Backtrace:
  1. epibuffet::tab_survey(...) tests/testthat/test-tabulate_survey.R:286:2
 15. dplyr:::stop_mutate_recycle_incompatible_size(e, index = i, dots = dots)
 16. dplyr:::stop_dplyr(...)

test-tabulate_survey.R:351: warning: tab_survey fails when there is only one group and missing data
removing 45 missing value(s) from `banana`
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

══ Results ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 13.5 s

OK:       231
Failed:   3
Warnings: 1
Skipped:  0
zkamvar commented 4 years ago

This was an issue with recasting a character column as a factor where there were duplicate entries. I've set it up so that it works now, but it's now failing in the prettify_tabulation because of the effects of dplyr::bind_cols auto-checks the column names and "helpfully edits" the duplicates with name_repair with no way to affect this change externally. >:(

aspina7 commented 4 years ago

annoying ... would it help if we pre-pend something to the duplicate names (e.g. varname or whatever)? But I guess we would see the same issue augment_reduntant then?

zkamvar commented 4 years ago

Unfortunately, it is a couple of things wrapped into one that I have to spend some time thinking about. I've been able to find some balance in my schedule these days, so I can dedicate some time on the weekends to looking at this.

zkamvar commented 4 years ago

This should fix things nicely: https://github.com/tidyverse/dplyr/pull/5452