Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect denom counts when creating combined treatment group #8

Closed
snehagaddam opened this issue Sep 24, 2020 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@snehagaddam
Copy link

Description

[Description of the bug or feature]

Steps to Reproduce (Bug Report Only)

I executed the following code:

adae_table <- tplyr_table(adae, TRTA) %>%
  add_treat_grps("Treated" = c("Xanomeline High Dose", "Xanomeline Low Dose")) %>%
  add_layer(
    group_count(AEDECOD) %>%
      set_distinct_by(USUBJID) %>% 
      set_nest_count(TRUE)
  )

adae_build <- adae_table %>%
  build()

Expected behavior: The creation of a combined treatment group named "Treated", and accurately calculated summary statistics for all treatment groups.

Actual behavior: While a new treatment group named "Treated" was created, and denominator counts and percentages were correctly calculated, this is not the case for the original two treatment groups. "Xanomeline High Dose" and "Xanomeline Low Dose" denominator counts are not being correctly calculated, causing the percentages to be rendered as "(Inf%)".

Versions

R version 4.0.2 (2020-06-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.5 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 [5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] huxtable_5.0.0 magrittr_1.5 Tplyr_0.1.1 forcats_0.5.0 stringr_1.4.0 [6] dplyr_1.0.0 purrr_0.3.4 readr_1.3.1 tidyr_1.1.0 tibble_3.0.3 [11] ggplot2_3.3.2 tidyverse_1.3.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.5 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.2 dbplyr_1.4.4 [6] odbc_1.2.3 tools_4.0.2 bit_1.1-15.2 lubridate_1.7.9 jsonlite_1.7.0 [11] lifecycle_0.2.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7 reprex_0.3.0 [16] cli_2.0.2 DBI_1.1.0 rstudioapi_0.11 yaml_2.2.1 haven_2.3.1 [21] xfun_0.15 withr_2.2.0 xml2_1.3.2 httr_1.4.2 knitr_1.29 [26] fs_1.4.2 hms_0.5.3 generics_0.0.2 vctrs_0.3.2 bit64_0.9-7.1 [31] grid_4.0.2 tidyselect_1.1.0 glue_1.4.1 R6_2.4.1 fansi_0.4.1 [36] readxl_1.3.1 modelr_0.1.8 blob_1.2.1 backports_1.1.8 scales_1.1.1 [41] ellipsis_0.3.1 rvest_0.3.5 assertthat_0.2.1 colorspace_1.4-1 stringi_1.4.6 [46] munsell_0.5.0 broom_0.7.0 crayon_1.3.4

@elimillera
Copy link
Member

@snehagaddam thanks for the issue!
The dplyr::distinct() function didn't include !!treat_var in count.R which would cause it to remove the rows of the grouped treatments.
See PR 370: Fix bug for pcts when there is a distinct_by and a custom group for the fix.

This has been resolved on GitHub and CRAN with the release of 0.1.2.

@mstackhouse
Copy link
Contributor

Just writing to note that this update is up and posted to CRAN.

@mstackhouse mstackhouse added the bug Something isn't working label Sep 30, 2020
@snehagaddam
Copy link
Author

Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants