opened 10:32AM - 11 Dec 21 UTC
Hello, it seems that there's a problem when using `flextable` in `officedown`: t…he caption appears at the bottom of the table, and the suffix for numbering chunk (“:”) can't be changed.
I prepared a piece of code to reproduce the problem:
``````
---
output:
officedown::rdocx_document:
tables:
caption:
sep: '. '
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = FALSE,
fig.cap = TRUE,
message = FALSE,
warning = FALSE
)
library(officedown)
library(officer)
library(flextable)
library(tidyverse)
```
```{r}
tribble(
~ model, ~ column_1, ~ column_2,
"GLM", "1", "25",
"RF", "1", "25",
"XRT", "1", "25"
) %>%
flextable() %>%
set_caption("Models trained and evaluated during multiple algorithms assessment.",
autonum = run_autonum(seq_id = "tab", bkm = "models"))
```
``````
It would be rendered as:

I was wondering, how to make the caption above the table, and use ". " as the suffix of number?
Your kind guidance is much appreciated!
``` r
library(officedown)
library(officer)
library(flextable)
library(tidyverse)
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] forcats_0.5.1 stringr_1.4.0.9000 dplyr_1.0.7 purrr_0.3.4
#> [5] readr_2.0.2 tidyr_1.1.4 tibble_3.1.5 ggplot2_3.3.5
#> [9] tidyverse_1.3.1 flextable_0.6.9 officer_0.4.2.001 officedown_0.2.3
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.7 lubridate_1.7.10 assertthat_0.2.1 digest_0.6.28
#> [5] utf8_1.2.2 cellranger_1.1.0 R6_2.5.1 backports_1.3.0
#> [9] reprex_2.0.1 evaluate_0.14 httr_1.4.2 highr_0.9
#> [13] pillar_1.6.4 gdtools_0.2.3 rlang_0.4.12 readxl_1.3.1
#> [17] uuid_1.0-3 rstudioapi_0.13 data.table_1.14.2 rmarkdown_2.11
#> [21] munsell_0.5.0 broom_0.7.10 compiler_4.0.3 modelr_0.1.8
#> [25] xfun_0.28 pkgconfig_2.0.3 systemfonts_1.0.2 base64enc_0.1-3
#> [29] rvg_0.2.5 htmltools_0.5.2 tidyselect_1.1.1 fansi_0.5.0
#> [33] crayon_1.4.2 tzdb_0.1.2 dbplyr_2.1.1 withr_2.4.2
#> [37] grid_4.0.3 jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.1
#> [41] DBI_1.1.1 magrittr_2.0.1 scales_1.1.1 zip_2.2.0
#> [45] cli_3.1.0 stringi_1.7.5 cachem_1.0.6 fs_1.5.0
#> [49] xml2_1.3.2 ellipsis_0.3.2 generics_0.1.1 vctrs_0.3.8
#> [53] tools_4.0.3 glue_1.5.0 hms_1.1.1 fastmap_1.1.0
#> [57] yaml_2.2.1 colorspace_2.0-2 rvest_1.0.1 memoise_2.0.1
#> [61] knitr_1.36 haven_2.4.3
```
<sup>Created on 2021-12-11 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup>