davidgohel / flextable

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

duplicated column names error when table has a column named part #531

Closed PavoDive closed 1 year ago

PavoDive commented 1 year ago

I have a table with one of the columns named part (short for "participation"). It causes flextable to error with

Error in merge.data.table(z, rows_data, by = c("part", "ft_row_id")) : 
  x has some duplicated column name(s): part. Please remove or rename the duplicate(s) and try again.

Reproducible example:

a = data.frame(x = 1:3, y = 2:4)   
flextable(a)  # no error

a = data.frame(x = 1:3, part = 2:4)
flextable(a)  # error as described
> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 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_CA.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] scales_1.2.1      flextable_0.9.0   data.table_1.14.8

loaded via a namespace (and not attached):
 [1] zip_2.2.2               Rcpp_1.0.10             fontBitstreamVera_0.1.1
 [4] compiler_4.2.3          later_1.3.0             gfonts_0.2.0           
 [7] tools_4.2.3             uuid_1.1-0              digest_0.6.31          
[10] bit_4.0.5               evaluate_0.20           jsonlite_1.8.4         
[13] memoise_2.0.1           lifecycle_1.0.3         rlang_1.1.0            
[16] shiny_1.7.4             cli_3.6.0               crul_1.3               
[19] curl_5.0.0              fontLiberation_0.1.0    xfun_0.37              
[22] fastmap_1.1.1           xml2_1.3.3              officer_0.6.1          
[25] knitr_1.42              askpass_1.1             gdtools_0.3.2          
[28] systemfonts_1.0.4       triebeard_0.4.1         bit64_4.0.5            
[31] grid_4.2.3              glue_1.6.2              httpcode_0.3.0         
[34] R6_2.5.1                textshaping_0.3.6       rmarkdown_2.20         
[37] fontquiver_0.2.1        magrittr_2.0.3          urltools_1.7.3         
[40] promises_1.2.0.1        htmltools_0.5.4         ellipsis_0.3.2         
[43] colorspace_2.1-0        mime_0.12               xtable_1.8-4           
[46] httpuv_1.6.9            ragg_1.2.5              munsell_0.5.0          
[49] openssl_2.0.6           cachem_1.0.7            crayon_1.5.2
davidgohel commented 1 year ago

thanks, we will fix

davidgohel commented 1 year ago

It should be fixed now

github-actions[bot] commented 8 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.