rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
2.03k stars 209 forks source link

as_word and gtsave seem to be adding an "X" at the end of the caption in the word file #1692

Open vikasrawal opened 5 months ago

vikasrawal commented 5 months ago

Description

as_word and gtsave seem to be adding an "X" at the end of the caption in the word file. Please see the example below. I am using gt version gt_0.10.1

Reproducible example

gt(head(iris)) |> tab_header(title="Caption for table") ->t
gtsave(t,"temp.docx")

Expected result

The code should produce a caption like:

Table 1: Caption for table

But instead, it produces:

Table 1: Caption for tableX

Session info

R version 4.4.0 (2024-04-24) Platform: x86_64-pc-linux-gnu Running under: Manjaro Linux

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

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

time zone: Asia/Kolkata tzcode source: system (glibc)

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

other attached packages: [1] gt_0.10.1

loaded via a namespace (and not attached): [1] digest_0.6.35 utf8_1.2.4 R6_2.5.1 fastmap_1.1.1 xfun_0.43 tidyselect_1.2.1 [7] magrittr_2.0.3 glue_1.7.0 tibble_3.2.1 knitr_1.46 pkgconfig_2.0.3 htmltools_0.5.8.1 [13] rmarkdown_2.26 dplyr_1.1.4 generics_0.1.3 lifecycle_1.0.4 xml2_1.3.6 cli_3.6.2
[19] fansi_1.0.6 vctrs_0.6.5 withr_3.0.0 compiler_4.4.0 tools_4.4.0 evaluate_0.23
[25] pillar_1.9.0 fs_1.6.3 rlang_1.1.3

vikasrawal commented 3 months ago

Hi. Any idea what is the source of this error?