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

unclear error in export_as_txt #634

Closed
clarkliming opened this issue May 16, 2023 · 1 comment · Fixed by insightsengineering/formatters#152
Closed

unclear error in export_as_txt #634

clarkliming opened this issue May 16, 2023 · 1 comment · Fixed by insightsengineering/formatters#152
Assignees

Comments

@clarkliming
Copy link
Contributor

clarkliming commented May 16, 2023

export_as_txt produces the following error:

Error in `mf_rinfo<-`(`*tmp*`, value = rinfo) :
Rows in new row_info component (93) does not match number of rows reflected in line_grouping component (92)

with the following table:

library(rtables)
tbl <- basic_table(show_colcounts = TRUE) %>%
    split_cols_by("ACTARM") %>%
    split_rows_by(
      "PARAMCD",
      labels_var = "PARAM",
      split_fun = drop_split_levels,
      label_pos = "hidden",
      split_label = "Parameter"
    ) %>%
    split_rows_by(
      "AVISIT",
      split_fun = drop_split_levels,
      label_pos = "hidden",
      split_label = "Visit"
    ) %>%
    split_cols_by_multivar(
      vars = c("AVAL", "CHG"),
      varlabels = c("Analysis Value", "Change from\nBaseline"),
      nested = TRUE
    ) %>%
    analyze_colvars(afun = make_afun(tern::a_summary, .stats = c("n", "mean_sd", "median", "range"))) %>%
    build_table(formatters::ex_adlb)

formatters::export_as_txt(tbl, lpp = 100)

session info

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] chevron_0.1.4.9011 testthat_3.1.6    

loaded via a namespace (and not attached):
  [1] colorspace_2.1-0      ellipsis_0.3.2        rprojroot_2.0.3      
  [4] fs_1.6.1              rstudioapi_0.14       roxygen2_7.2.3       
  [7] farver_2.1.1          remotes_2.4.2         waldo_0.4.0          
 [10] DT_0.27               fansi_1.0.4           diffobj_0.3.5        
 [13] xml2_1.3.3            splines_4.2.2         cachem_1.0.6         
 [16] knitr_1.42            pkgload_1.3.2         jsonlite_1.8.4       
 [19] vdiffr_1.0.5          broom_1.0.3           shiny_1.7.4          
 [22] compiler_4.2.2        backports_1.4.1       Matrix_1.5-3         
 [25] fastmap_1.1.0         lazyeval_0.2.2        cli_3.6.0            
 [28] later_1.3.0           htmltools_0.5.4       prettyunits_1.1.1    
 [31] tools_4.2.2           igraph_1.4.0          gtable_0.3.1         
 [34] glue_1.6.2            dplyr_1.1.0           Rcpp_1.0.10          
 [37] carData_3.0-5         vctrs_0.6.0           xfun_0.37            
 [40] stringr_1.5.0         rbibutils_2.2.13      ps_1.7.2             
 [43] brio_1.1.3            rlistings_0.2.1.9003  mime_0.12            
 [46] miniUI_0.1.1.1        lifecycle_1.0.3       devtools_2.4.5       
 [49] scales_1.2.1          promises_1.2.0.1      rtables_0.6.0.9004   
 [52] rex_1.2.1             rematch2_2.1.2        tern_0.8.1.9012      
 [55] yaml_2.3.7            memoise_2.0.1         gridExtra_2.3        
 [58] ggplot2_3.4.1         stringi_1.7.12        nestcolor_0.1.1.9001 
 [61] desc_1.4.2            checkmate_2.1.0       pkgbuild_1.4.0       
 [64] dunlin_0.1.2.9007     Rdpack_2.4            rlang_1.1.0          
 [67] pkgconfig_2.0.3       commonmark_1.8.1      evaluate_0.20        
 [70] dm_1.0.5              lattice_0.20-45       purrr_1.0.1          
 [73] htmlwidgets_1.6.1     labeling_0.4.2        cowplot_1.1.1        
 [76] processx_3.8.0        tidyselect_1.2.0      magrittr_2.0.3       
 [79] R6_2.5.1              generics_0.1.3        profvis_0.3.7        
 [82] DBI_1.1.3             pillar_1.8.1          withr_2.5.0          
 [85] survival_3.5-3        abind_1.4-5           tibble_3.1.8         
 [88] crayon_1.5.2          car_3.1-1             utf8_1.2.3           
 [91] urlchecker_1.0.1      usethis_2.1.6         grid_4.2.2           
 [94] callr_3.7.3           formatters_0.4.1.9002 forcats_1.0.0        
 [97] digest_0.6.31         xtable_1.8-4          tidyr_1.3.0          
[100] httpuv_1.6.9          covr_3.6.1            munsell_0.5.0        
[103] sessioninfo_1.2.2
@Melkiades
Copy link
Contributor

So I tried with diagnose_pagination(tbl, lpp = 100) and I could not find the culprit there. Still this is an issue for formatters

gmbecker added a commit that referenced this issue May 17, 2023
* Fixes for clean check (when combined with fixes in formatters). vbump

* small fixes

* This fixes the constant warning with devtools and the reexport rd warning in checks (-> TO DISCUSS)

* vignette production is for .gitignore

* fix for pkgdown

* preserve topleft when paginating.

* Add alias to fix pkgdown error

* diff went crazy but I just reduce the dispatching to avoid cluttering reference

* reverting and forwarding

* Update DESCRIPTION

Co-authored-by: Joe Zhu <joe.zhu@roche.com>
Signed-off-by: Davide Garolini <dgarolini@gmail.com>

* regression test for #634, mark some methods as internal

---------

Signed-off-by: Davide Garolini <dgarolini@gmail.com>
Co-authored-by: Gabriel Becker <gabembecker@gmail.com>
Co-authored-by: Emily de la Rua <emily.de_la_rua@contractors.roche.com>
Co-authored-by: Joe Zhu <joe.zhu@roche.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants