davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
565 stars 82 forks source link

proc_freq error {FUN(newX[, i], ...) : unused argument (simplify = FALSE)} #647

Closed ravazad closed 3 months ago

ravazad commented 3 months ago

proc_freq is producing the following error and I could not find a solution online or in the bug reports section.

proc_freq(mtcars, "gear", "vs", weight = "wt") Error in FUN(newX[, i], ...) : unused argument (simplify = FALSE)

sessionInfo() R version 4.0.4 (2021-02-15) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages: [1] data.table_1.14.2 tables_0.9.6 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.8 purrr_0.3.4
[7] readr_2.1.2 tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1 flextable_0.9.6

loaded via a namespace (and not attached): [1] httr_1.4.2 jsonlite_1.8.0 modelr_0.1.8 shiny_1.7.1
[5] assertthat_0.2.1 askpass_1.1 fontLiberation_0.1.0 cellranger_1.1.0
[9] gdtools_0.3.7 pillar_1.7.0 backports_1.4.1 glue_1.6.2
[13] uuid_1.1-0 digest_0.6.29 promises_1.2.0.1 rvest_1.0.2
[17] colorspace_2.0-3 htmltools_0.5.2 httpuv_1.6.5 gfonts_0.2.0
[21] fontBitstreamVera_0.1.1 pkgconfig_2.0.3 httpcode_0.3.0 broom_0.8.0
[25] haven_2.5.0 xtable_1.8-4 scales_1.2.0 later_1.3.0
[29] officer_0.6.6 fontquiver_0.2.1 tzdb_0.3.0 openssl_2.0.0
[33] generics_0.1.2 ellipsis_0.3.2 withr_2.5.0 cli_3.2.0
[37] magrittr_2.0.3 crayon_1.5.1 readxl_1.4.0 mime_0.12
[41] evaluate_0.15 fs_1.5.2 fansi_1.0.3 xml2_1.3.3
[45] textshaping_0.3.6 tools_4.0.4 hms_1.1.1 lifecycle_1.0.1
[49] munsell_0.5.0 reprex_2.0.1 zip_2.2.0 compiler_4.0.4
[53] systemfonts_1.0.4 rlang_1.0.2 grid_4.0.4 rstudioapi_0.13
[57] rmarkdown_2.13 gtable_0.3.0 DBI_1.1.2 curl_4.3.2
[61] R6_2.5.1 lubridate_1.8.0 knitr_1.38 fastmap_1.1.0
[65] utf8_1.2.2 ragg_1.2.2 stringi_1.7.6 crul_1.5.0
[69] Rcpp_1.0.8.3 vctrs_0.4.1 dbplyr_2.1.1 tidyselect_1.1.2
[73] xfun_0.30

ravazad commented 3 months ago

I was debugging further and I found out that if I change the proc_freq(mtcars, "vs", "gear") to the code below it works partially with include.row_percent = FALSE, include.column_percent = FALSE, if I change those two parameters to TRUE it throws an error.

proc_freq( mtcars, "vs", "gear", include.row_percent = FALSE, include.column_percent = FALSE, include.table_percent = TRUE )

davidgohel commented 3 months ago

hello,

I can't reproduce the issue. I tried with:

> sessionInfo()
R version 4.0.4 (2021-02-15)
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/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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] flextable_0.6.4

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6        digest_0.6.27     R6_2.5.0          evaluate_0.14    
 [5] zip_2.1.1         rlang_0.4.10      gdtools_0.2.3     uuid_0.1-4       
 [9] data.table_1.14.0 xml2_1.3.2        rmarkdown_2.7     tools_4.0.4      
[13] officer_0.3.17    xfun_0.22         compiler_4.0.4    systemfonts_1.0.1
[17] base64enc_0.1-3   htmltools_0.5.1.1 knitr_1.31

I also tried with

> sessionInfo()
R version 4.0.4 (2021-02-15)
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/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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] flextable_0.9.7.003

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6        rstudioapi_0.13   knitr_1.31        xml2_1.3.2       
 [5] uuid_0.1-4        R6_2.5.0          rlang_0.4.10      tools_4.0.4      
 [9] pkgbuild_1.2.0    data.table_1.14.0 xfun_0.22         cli_2.3.1        
[13] withr_2.4.1       htmltools_0.5.1.1 systemfonts_1.0.1 remotes_2.2.0    
[17] rprojroot_2.0.2   assertthat_0.2.1  digest_0.6.27     crayon_1.4.1     
[21] processx_3.5.0    zip_2.1.1         officer_0.6.6     callr_3.6.0      
[25] base64enc_0.1-3   ps_1.6.0          curl_4.3          glue_1.4.2       
[29] evaluate_0.14     rmarkdown_2.7     compiler_4.0.4    prettyunits_1.1.1
[33] gdtools_0.3.7

and tried with

R version 4.4.0 (2024-04-24)
Platform: x86_64-apple-darwin20
Running under: macOS Sonoma 14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Paris
tzcode source: internal

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

other attached packages:
[1] knitr_1.48          data.table_1.15.4   testthat_3.2.1.1    xml2_1.3.6         
[5] officer_0.6.6       flextable_0.9.7.003

loaded via a namespace (and not attached):
 [1] katex_1.4.1             jsonlite_1.8.8          compiler_4.4.0         
 [4] crayon_1.5.3            equatags_0.2.2.001      brio_1.1.5             
 [7] promises_1.3.0          zip_2.3.1               Rcpp_1.0.13            
[10] later_1.3.2             fontquiver_0.2.1        systemfonts_1.1.0      
[13] textshaping_0.4.0       uuid_1.2-1              fastmap_1.2.0          
[16] mime_0.12               R6_2.5.1                gfonts_0.2.0           
[19] gdtools_0.3.7           curl_5.2.1              openssl_2.2.0          
[22] crul_1.5.0              shiny_1.9.0             rlang_1.1.4            
[25] V8_4.4.2                httpcode_0.3.0          httpuv_1.6.15          
[28] xfun_0.46               cli_3.6.3               magrittr_2.0.3         
[31] digest_0.6.36           grid_4.4.0              rstudioapi_0.16.0      
[34] xtable_1.8-4            askpass_1.2.0           lifecycle_1.0.4        
[37] evaluate_0.24.0         glue_1.7.0              fontLiberation_0.1.0   
[40] ragg_1.3.2              xslt_1.4.5              fontBitstreamVera_0.1.1
[43] rmarkdown_2.27          tools_4.4.0             htmltools_0.5.8.1
ravazad commented 3 months ago

Thanks David for looking into this. I tried running the same code in the home computer and it works fine. It appears something is wrong with my office computer setup.

Best regards, Rav


From: David Gohel @.> Sent: Saturday, August 3, 2024 10:13 AM To: davidgohel/flextable @.> Cc: ravazad @.>; Author @.> Subject: Re: [davidgohel/flextable] proc_freq error {FUN(newX[, i], ...) : unused argument (simplify = FALSE)} (Issue #647)

hello,

I can't reproduce the issue. I tried with:

sessionInfo() R version 4.0.4 (2021-02-15) 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/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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] flextable_0.6.4

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 digest_0.6.27 R6_2.5.0 evaluate_0.14 [5] zip_2.1.1 rlang_0.4.10 gdtools_0.2.3 uuid_0.1-4 [9] data.table_1.14.0 xml2_1.3.2 rmarkdown_2.7 tools_4.0.4 [13] officer_0.3.17 xfun_0.22 compiler_4.0.4 systemfonts_1.0.1 [17] base64enc_0.1-3 htmltools_0.5.1.1 knitr_1.31

I also tried with

sessionInfo() R version 4.0.4 (2021-02-15) 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/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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] flextable_0.9.7.003

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 rstudioapi_0.13 knitr_1.31 xml2_1.3.2 [5] uuid_0.1-4 R6_2.5.0 rlang_0.4.10 tools_4.0.4 [9] pkgbuild_1.2.0 data.table_1.14.0 xfun_0.22 cli_2.3.1 [13] withr_2.4.1 htmltools_0.5.1.1 systemfonts_1.0.1 remotes_2.2.0 [17] rprojroot_2.0.2 assertthat_0.2.1 digest_0.6.27 crayon_1.4.1 [21] processx_3.5.0 zip_2.1.1 officer_0.6.6 callr_3.6.0 [25] base64enc_0.1-3 ps_1.6.0 curl_4.3 glue_1.4.2 [29] evaluate_0.14 rmarkdown_2.7 compiler_4.0.4 prettyunits_1.1.1 [33] gdtools_0.3.7

and tried with

R version 4.4.0 (2024-04-24) Platform: x86_64-apple-darwin20 Running under: macOS Sonoma 14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Paris tzcode source: internal

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

other attached packages: [1] knitr_1.48 data.table_1.15.4 testthat_3.2.1.1 xml2_1.3.6 [5] officer_0.6.6 flextable_0.9.7.003

loaded via a namespace (and not attached): [1] katex_1.4.1 jsonlite_1.8.8 compiler_4.4.0 [4] crayon_1.5.3 equatags_0.2.2.001 brio_1.1.5 [7] promises_1.3.0 zip_2.3.1 Rcpp_1.0.13 [10] later_1.3.2 fontquiver_0.2.1 systemfonts_1.1.0 [13] textshaping_0.4.0 uuid_1.2-1 fastmap_1.2.0 [16] mime_0.12 R6_2.5.1 gfonts_0.2.0 [19] gdtools_0.3.7 curl_5.2.1 openssl_2.2.0 [22] crul_1.5.0 shiny_1.9.0 rlang_1.1.4 [25] V8_4.4.2 httpcode_0.3.0 httpuv_1.6.15 [28] xfun_0.46 cli_3.6.3 magrittr_2.0.3 [31] digest_0.6.36 grid_4.4.0 rstudioapi_0.16.0 [34] xtable_1.8-4 askpass_1.2.0 lifecycle_1.0.4 [37] evaluate_0.24.0 glue_1.7.0 fontLiberation_0.1.0 [40] ragg_1.3.2 xslt_1.4.5 fontBitstreamVera_0.1.1 [43] rmarkdown_2.27 tools_4.4.0 htmltools_0.5.8.1

— Reply to this email directly, view it on GitHubhttps://github.com/davidgohel/flextable/issues/647#issuecomment-2267073556, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BKJFGLVDFGCDESWGWOTVVIDZPUFVBAVCNFSM6AAAAABL5HEPWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRXGA3TGNJVGY. You are receiving this because you authored the thread.