vincentarelbundock / modelsummary

Beautiful and customizable model summaries in R.
http://modelsummary.com
Other
912 stars 77 forks source link

Modelsummary with flextable output knitting to Word - unused arguments error #572

Closed astraetech closed 1 year ago

astraetech commented 2 years ago

Hi Vincent,

Really not sure what's going on here as things were working great back in Spring. Knitting to Word worked without a hitch.

Here is a reprex. I get an error when knitting this to Word. HTML works fine.

---
title: "Untitled"
output: word_document
date: "2022-11-11"
---

```{r  beg}
knitr::opts_chunk$set(echo = TRUE)
library(modelsummary)
library(tidyverse)
fit_mt <- mtcars %>% lm(hp~gear, data=.)
modelsummary(fit_mt , output = "flextable")
\```

Error:

Quitting from lines 19-21 (testing_flextable.Rmd) 
Error in prop_table(style = NULL, layout = table_layout(type = "fixed"),  : 
  unused arguments (word_title = x$properties$word_title, word_description = x$properties$word_description)
Calls: <Anonymous> ... knit_print.flextable -> flextable_to_rmd -> knit_to_wml -> gen_raw_wml
Execution halted

It seems those params are set in flextable in one place but it seems not used when modelsummary calls flextable? Applies to both "fixed" and "autofit".

If you could take a look at this it would be awesome. Thank you for developing this package as always :)

vincentarelbundock commented 2 years ago

I cannot replicate this error. The notebook compiles fine on my computer. Can you uninstall all the relevant packages, including modelsummary flextable rmarkdown, reinstall all the latest versions, and try again.

Do you get an error with a simple flextable example, without modelsummary? If so, the error should be reported on their repository.

astraetech commented 2 years ago

Here is my SessionInfo:

> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

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

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

other attached packages:
  [1] tidylog_1.0.2.9000         FFdownload_1.1.0           feather_0.3.5              furrr_0.3.1.9000          
  [5] rstatix_0.7.0              infer_1.0.3.9000           estimatr_1.0.0             colorDF_0.1.7             
  [9] ganttrify_0.0.0.9008       timevis_2.0.0.9000         frenchdata_0.2.0.9000      table.express_0.4.1       
 [13] correlationfunnel_0.2.0    TSstudio_0.1.6             trelliscopejs_0.2.10       flow_0.1.0                
 [17] boomer_0.1.1               explore_0.9.0              olsrr_0.6.0                reactable_0.3.0           
 [21] corrr_0.4.4.9000           startowd_0.1.0             vtable_1.3.4               echarts4r_0.4.4           
 [25] autostats_0.3.1            presenter_0.1.1            tidybins_0.1.0             framecleaner_0.2.0        
 [29] TidyConsultant_0.1.0       highcharter_0.9.4.9000     ggoutlier_0.1.0            dlookr_0.6.1.9001         
 [33] dataReporter_1.0.0         SmartEDA_0.3.8             GGally_2.1.2.9000          DataExplorer_0.8.2        
 [37] padr_0.6.1                 rmsfuns_1.0.0.1            validate_1.1.1             naniar_0.6.1              
 [41] dtplyr_1.2.1               rpolygon.io_0.0.0.9000     doFuture_0.12.2-9000       future_1.29.0             
 [45] glueformula_0.1.0          threejs_0.3.4              igraph_1.3.5               fixest_0.11.0             
 [49] multidplyr_0.1.2.9000      binance_0.0.4              binancer_1.2.0             rameritrade_0.1.5         
 [53] crypto_1.1.3               rvest_1.0.3                censusapi_0.8.0.9000       rgdax_1.2.1               
 [57] httr_1.4.4                 RCurl_1.98-1.8             jsonlite_1.8.3             digest_0.6.30             
 [61] hpiR_0.3.4                 modelsummary_1.1.0.9000    Rfast_2.0.6                RcppZiggurat_0.1.6        
 [65] Rcpp_1.0.9                 collapse_1.8.6             rcanvas_0.0.0.9001         reticulate_1.25-9000      
 [69] DataEditR_0.1.5            texreg_1.38.6              laviz_0.0.0.9000           qs_0.25.4                 
 [73] fst_0.9.8                  pointr_0.2.0               duckdb_0.4.0               RPostgreSQL_0.7-3         
 [77] DBI_1.1.3.9000             odbc_1.3.3.9000            pmdplyr_0.3.4              ExPanDaR_0.5.3            
 [81] fastDummies_1.6.3          DescTools_0.99.45          openxlsx_4.2.5             devEMF_4.1                
 [85] rvg_0.2.5                  rsvg_2.3.1                 xml2_1.3.3                 validata_0.1.0            
 [89] ftExtra_0.4.0.9999         huxtable_5.5.0.9000        flextable_0.8.3            sjlabelled_1.2.0          
 [93] safejoin_0.1.0             diffdf_1.0.4               corrplot_0.92              flipTime_2.9.5            
 [97] slider_0.2.2.9000          tsibbledata_0.4.0          feasts_0.2.2               fabletools_0.3.2          
[101] tsibble_1.1.1              plm_2.6-1                  outliers_0.15              lfe_2.8-8                 
[105] stargazer_5.2.3            arsenal_3.6.3              janitor_2.1.0              qwraps2_0.5.2             
[109] kableExtra_1.3.4           psych_2.2.5                xtable_1.8-4               basictabler_1.0.2         
[113] descr_1.1.5                gt_0.7.0                   gtsummary_1.6.2.9000       officer_0.4.4.001         
[117] tidycensus_1.2.2           metricsgraphics_0.9.0      Hmisc_4.7-0                Formula_1.2-4             
[121] survival_3.4-0             lattice_0.20-45            summarytools_1.0.0         skimr_2.1.4               
[125] tidyquant_1.0.4            lubridate_1.9.0            timechange_0.1.1           tmap_3.3-3                
[129] broom_1.0.1                mapview_2.11.0             rgdal_1.5-32               sp_1.5-0                  
[133] sf_1.0-8                   RColorBrewer_1.1-3         mapdeck_0.3.40004          googleway_2.7.6001        
[137] glue_1.6.2.9000            anomalize_0.2.2            transformr_0.1.3           gganimate_1.0.7           
[141] RgoogleMaps_1.4.5.3        gifski_1.6.6-1             ggmap_3.0.0.903            microbenchmark_1.4.9      
[145] reshape2_1.4.4             gtrendsR_1.5.1.9000        installr_0.23.2            rlang_1.0.6.9000          
[149] haven_2.5.1                xlsx_0.6.5                 pbapply_1.5-0              pander_0.6.5              
[153] dygraphs_1.1.1.7           ff_4.0.7                   bit_4.0.4                  data.table_1.14.5         
[157] anytime_0.3.9              readxl_1.4.1               forcats_0.5.2              dplyr_1.0.99.9000         
[161] purrr_0.3.5                readr_2.1.3                tidyr_1.2.1                tibble_3.1.8              
[165] tidyverse_1.3.2            stringr_1.4.1              stringi_1.7.8              mnormt_2.1.0              
[169] ggplot2_3.4.0              plyr_1.8.7                 gdata_2.18.0.1             compare_0.2-6             
[173] PerformanceAnalytics_2.0.4 quantmod_0.4.20            TTR_0.24.3                 xts_0.12.2                
[177] timeSeries_4021.104        timeDate_4021.106          foreign_0.8-83             qpcR_1.4-1                
[181] Matrix_1.5-1               robustbase_0.95-0          rgl_0.109.6                minpack.lm_1.2-2          
[185] MASS_7.3-58.1              zoo_1.8-11                 sas7bdat_0.6               iterators_1.0.14          
[189] foreach_1.5.2              listviewer_3.0.0           ellipsis_0.3.2             curl_4.3.3                
[193] checkpoint_1.0.2           devtools_2.4.4             usethis_2.1.6.9000         pacman_0.5.1              

loaded via a namespace (and not attached):
  [1] urlchecker_1.0.1        fracdiff_1.5-2          abind_1.4-5             katex_1.4.0            
  [5] modelr_0.1.8            memoise_2.0.1           emmeans_1.8.1-1         units_0.8-0            
  [9] munsell_0.5.0           performance_0.10.0.3    scales_1.2.1            listenv_0.8.0          
 [13] blob_1.2.3              bayestestR_0.13.0       pagedown_0.19           shinyjs_2.1.0          
 [17] leaflet_2.1.1           workflows_1.1.0         mclust_5.4.10           pryr_0.1.5             
 [21] jpeg_0.1-9              htmltools_0.5.3         pdp_0.8.1               clisymbols_1.2.0       
 [25] jquerylib_0.1.4         warp_0.2.0              xslt_1.4.3              XML_3.99-0.11          
 [29] urca_1.3-3              styler_1.7.0            parsnip_1.0.2           openssl_2.0.4          
 [33] tcltk_4.2.1             hrbrthemes_0.8.0        crayon_1.5.2            tidyselect_1.2.0       
 [37] rsample_1.1.0           withr_2.5.0             RcppParallel_5.1.5      fstcore_0.9.12         
 [41] future.apply_1.10.0     imputeTS_3.2            DEoptimR_1.0-11         shiny_1.7.2            
 [45] tzdb_0.3.0              googlesheets4_1.0.0     Rdpack_2.4              multcomp_1.4-20        
 [49] equatags_0.2.0          rappdirs_0.3.3          GPfit_1.0-8             gdtools_0.2.4          
 [53] sass_0.4.2              stars_0.5-6             yardstick_1.1.0         parallelly_1.32.1      
 [57] autocogs_0.1.4          RApiSerialize_0.1.2     deldir_1.0-6            interp_1.1-3           
 [61] fastmap_1.1.0           datawizard_0.6.3        uuid_1.1-0              fs_1.5.2.9000          
 [65] maxLik_1.5-2            stringfish_0.15.7       gargle_1.2.0            plotly_4.10.1          
 [69] ISLR_1.4                visdat_0.5.3            mvtnorm_1.1-3           cli_3.4.1              
 [73] profvis_0.3.7           DiceDesign_1.9          dbplyr_2.2.1            magick_2.7.3           
 [77] classInt_0.4-7          latticeExtra_0.6-30     lpSolve_5.6.15          gridtext_0.1.4         
 [81] pillar_1.8.1            prettyunits_1.1.1       R6_2.5.1.9000           Quandl_2.11.0          
 [85] remotes_2.4.2           bit64_4.0.5             lwgeom_0.2-8            dichromat_2.0-0.1      
 [89] stinepack_1.4           gtable_0.3.1            estimability_1.4.1      bslib_0.4.1            
 [93] xfun_0.34               lava_1.7.0              sampling_2.9            tweenr_1.0.2           
 [97] miniUI_0.1.1.1          gower_1.0.0             gtools_3.9.3            lifecycle_1.0.3        
[101] splines_4.2.1           KernSmooth_2.23-20      credentials_1.3.2       highr_0.9              
[105] showtextdb_3.0          globals_0.16.1          insight_0.18.6          backports_1.4.1-9000   
[109] viridisLite_0.4.1       utf8_1.2.2              xlsxjars_0.6.1          rpart_4.1.19           
[113] dials_1.0.0             generics_0.1.3          showtext_0.9-5          settings_0.2.7         
[117] askpass_1.1             leafem_0.2.0            htmlTable_2.4.1         tigris_1.6.1           
[121] sessioninfo_1.2.2       tmaptools_3.1-1         tune_1.0.0              recipes_1.0.3          
[125] fidelius_0.0.2          logger_0.2.2            hms_1.1.2               forecast_8.18          
[129] png_0.1-7               coda_0.19-4             rlist_0.4.6.2           rmarkdown_2.18         
[133] assertthat_0.2.1        lazyeval_0.2.2          inum_1.0-4              patchwork_1.1.2        
[137] V8_4.2.2                numDeriv_2016.8-1.1     sandwich_3.0-2          prodlim_2019.11.13     
[141] htmlwidgets_1.5.4.9000  hardhat_1.2.0           grid_4.2.1              R.oo_1.25.0            
[145] callr_3.7.3             parameters_0.19.0.10    rbibutils_2.2.8         zip_2.2.2              
[149] R.methodsS3_1.8.2       rio_0.5.29              DistributionUtils_0.6-0 fansi_1.0.3            
[153] matrixStats_0.62.0      cluster_2.1.4           ggtext_0.1.1            partykit_1.2-16        
[157] expm_0.999-6            systemfonts_1.0.4       knitr_1.40              bdsmatrix_1.3-6        
[161] ranger_0.14.1           repr_1.1.4              satellite_1.0.4         lmom_2.9               
[165] ps_1.7.2                raster_3.5-21           formatR_1.12            bitops_1.0-7           
[169] quadprog_1.5-8          timetk_2.8.1.9000       leafsync_0.1.0          networkD3_0.4          
[173] sysfonts_0.8.8          proxy_0.4-27            pkgload_1.3.0           TH.data_1.1-1          
[177] rapportools_1.1         clipr_0.8.0             gitcreds_0.1.2          rstudioapi_0.14        
[181] parallel_4.2.1          magrittr_2.0.3.9000     nortest_1.0-4           shinycssloaders_1.0.0  
[185] svglite_2.1.0           snakecase_0.11.0        ggpubr_0.4.0            libcoin_1.0-9          
[189] rhandsontable_0.3.9     Rttf2pt1_1.3.10         gridExtra_2.3           Exact_3.1              
[193] gld_2.6.5               stats4_4.2.1            lhs_1.1.5               terra_1.6-3            
[197] vctrs_0.5.0.9000        cachem_1.0.6            crosstalk_1.2.0         R.cache_0.16.0         
[201] colorspace_2.0-3        httpuv_1.6.6            carData_3.0-5           tseries_0.10-52        
[205] rootSolve_1.8.2.3       tbl2xts_1.0.4           base64enc_0.1-3         class_7.3-20           
[209] nnet_7.3-18             reprex_2.0.1            tables_0.9.10           later_1.3.0            
[213] reshape_0.8.9           extrafontdb_1.0         DT_0.25                 nlme_3.1-160           
[217] car_3.1-0               pkgbuild_1.3.1          ipred_0.9-13            checkmate_2.1.0        
[221] compiler_4.2.1          dreamerr_1.2.3          rJava_1.0-6             farver_2.1.1           
[225] extrafont_0.18          distributional_0.3.0    googledrive_2.0.0       codetools_0.2-18       
[229] evaluate_0.18           yaml_2.3.6              goftest_1.2-3           cellranger_1.1.0       
[233] promises_1.2.0.1        broom.helpers_1.9.0     tictoc_1.0.1            ggsignif_0.6.3         
[237] maptools_1.1-4          lmtest_0.9-40           webshot_0.5.4           shinyBS_0.61.1         
[241] boot_1.3-28             R.utils_2.12.0          pak_0.3.0               progress_1.2.2         
[245] processx_3.8.0          effectsize_0.8.2        e1071_1.7-11            mime_0.12              
[249] miscTools_0.6-26        pkgconfig_2.0.3   

Good to know it works on your end. I will perform testing on my end then.

astraetech commented 2 years ago

I uninstalled and reinstalled flextable. Just running flextable yields the same error. Posted on flextable issue tracker. https://github.com/davidgohel/flextable/issues/484

vincentarelbundock commented 1 year ago

so this is fixed upstream, right?