Tplyr icon indicating copy to clipboard operation
Tplyr copied to clipboard

add_total_row has no effect for shift layers

Open mstackhouse opened this issue 2 years ago • 1 comments

Prerequisites

For more information, see the CONTRIBUTING guide.

Description

On shift layers, add_total_row() is accepted but has no effect, while set_missing_count() explicitly produces an error.

Steps to Reproduce (Bug Report Only)

Struggled with reprex for this...

adlb <- haven::read_xpt(url("https://github.com/phuse-org/TestDataFactory/raw/main/Updated/TDF_ADaM/adlbc.xpt"))

t <- tplyr_table(adlb, TRTA, where=PARAMCD == "CK" & AVISIT == "Week 2") %>%
  add_layer(
    group_shift(vars(row = BNRIND, column = ANRIND), by = vars(PARAM, AVISIT)) %>%
      set_format_strings(f_str("x", n))
  ) 

t %>%
  build() 

Expected behavior: [What you expected to happen]

Either an error to signify not supported on Shift layers, or a total row.

Actual behavior: [What actually happened]

Table completes build with no messages

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     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              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] magrittr_2.0.2 Tplyr_0.4.4    shiny_1.5.0    testthat_3.1.2 dplyr_1.0.7   

loaded via a namespace (and not attached):
 [1] sass_0.4.0.9000   pkgload_1.2.4     tidyr_1.2.0       jsonlite_1.7.2    bslib_0.2.4       brio_1.1.3        assertthat_0.2.1  highr_0.9        
 [9] blob_1.2.1        yaml_2.2.1        remotes_2.4.2     sessioninfo_1.2.2 pillar_1.7.0      glue_1.6.1        digest_0.6.29     promises_1.1.1   
[17] htmltools_0.5.2   httpuv_1.5.4      clipr_0.8.0       pkgconfig_2.0.3   devtools_2.4.3    haven_2.4.3.9001  purrr_0.3.4       xtable_1.8-4     
[25] processx_3.5.2    whisker_0.4       later_1.1.0.1     tzdb_0.2.0        tibble_3.1.6      generics_0.1.2    usethis_2.1.3     ellipsis_0.3.2   
[33] cachem_1.0.6      withr_2.4.3       cli_3.2.0         crayon_1.5.0      mime_0.12         memoise_2.0.1     evaluate_0.14     ps_1.6.0         
[41] fs_1.5.1          fansi_1.0.2       forcats_0.5.1     pkgbuild_1.2.1    tools_4.0.2       prettyunits_1.1.1 hms_1.1.1         lifecycle_1.0.1  
[49] stringr_1.4.0     reprex_0.3.0      callr_3.7.0       jquerylib_0.1.4   compiler_4.0.2    rlang_1.0.1       rstudioapi_0.13   rmarkdown_2.10   
[57] waldo_0.3.1       DBI_1.1.0         R6_2.5.1          knitr_1.36        fastmap_1.1.0     utf8_1.2.2        rprojroot_2.0.2   readr_2.1.2      
[65] desc_1.4.0        stringi_1.7.6     Rcpp_1.0.8        vctrs_0.3.8       tidyselect_1.1.2  xfun_0.28        

_Note: This is currently from branch gh_issue_32 which is based on devel

mstackhouse avatar Mar 27 '22 18:03 mstackhouse

@mstackhouse I'm thinking we would want total row functionality for shift layers. Not sure how common that is but the functionality makes sense and I don't think it would be too tricky.

elimillera avatar Mar 29 '22 03:03 elimillera