ekstroem / dataReporter

85 stars 4 forks source link

makeCodebook: broken summary table if variable description contains a dash #5

Open soelderer opened 2 years ago

soelderer commented 2 years ago

I'm creating a codebook with makeCodebook for a dataset which includes variables with long labels. At some variable the codebook summary table ended abruptly with a horizontal row, messing with the table for the following variables.

I took a look at the Rmd-file and it turned out that the long variable label contained a dash, which unfortunately due to the lengthy label was placed in its own row with no other characters following. This might have been interpreted as a table row, breaking the layout. I'm rendering to pdf.

As this is an ongoing research project I can't share details, but here's how the Rmd looked like:

Some long label          **[name]**                          numeric              10  59.56 %  
-
with a dash.

Manually moving the dash to the above row and knitting fixed the issue.

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.10.0
LAPACK: /usr/lib/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8   
 [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] pander_0.6.4       ggplot2_3.3.5      eatGADS_0.19.1     rio_0.5.29         summarytools_1.0.0 dataReporter_1.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8         lubridate_1.8.0    whoami_1.3.0       tidyr_1.2.0        digest_0.6.29      utf8_1.2.2         R6_2.5.1          
 [8] cellranger_1.1.0   plyr_1.8.6         backports_1.4.1    evaluate_0.14      highr_0.9          httr_1.4.2         pillar_1.7.0      
[15] rlang_1.0.1        curl_4.3.2         readxl_1.3.1       data.table_1.14.2  magick_2.7.3       checkmate_2.0.0    rmarkdown_2.11    
[22] labeling_0.4.2     readr_2.1.2        stringr_1.4.0      foreign_0.8-82     tinytex_0.36       munsell_0.5.0      xfun_0.29         
[29] compiler_4.1.2     pkgconfig_2.0.3    base64enc_0.1-3    htmltools_0.5.2    tcltk_4.1.2        tidyselect_1.1.1   tibble_3.1.6      
[36] gridExtra_2.3      codetools_0.2-18   matrixStats_0.61.0 fansi_1.0.2        withr_2.4.3        crayon_1.4.2       dplyr_1.0.7       
[43] tzdb_0.2.0         grid_4.1.2         jsonlite_1.7.3     gtable_0.3.0       lifecycle_1.0.1    pacman_0.5.1       magrittr_2.0.2    
[50] scales_1.1.1       zip_2.2.0          cli_3.1.1          stringi_1.7.6      farver_2.1.0       pryr_0.1.5         robustbase_0.93-9 
[57] ellipsis_0.3.2     rapportools_1.0    generics_0.1.2     vctrs_0.3.8        openxlsx_4.2.5     tools_4.1.2        forcats_0.5.1     
[64] glue_1.6.1         DEoptimR_1.0-10    purrr_0.3.4        hms_1.1.0          yaml_2.2.2         fastmap_1.1.0      colorspace_2.0-2  
[71] knitr_1.37         haven_2.4.3