You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thank you for your continuous efforts in developing this package; it's excellent!
I've recently encountered a potential bug with the flextable_to_rmd function in version 0.9.6. It appears that local Rmarkdown chunk options are ignored by this function, leading to potential issues. This wasn't a problem before 0.9.6.
See a minimal reproducible example below where that issue causes the table not to be displayed because the local eval option is ignored.
---
output: html_document
---```{r}library(flextable)ft <- flextable(head(iris))```# Section 1 - It works```{r, eval = TRUE}
# Set global `eval` to `TRUE`knitr::opts_chunk$set(eval = TRUE)``````{r, eval = TRUE, results = "asis"}
# This works as expectedflextable_to_rmd(ft)```# Section 2 - It does not work```{r}# Set global `eval` to `FALSE`knitr::opts_chunk$set(eval = FALSE)``````{r, eval = TRUE, results = "asis"}
message("Current eval: ", knitr::opts_current$get("eval")) # TRUEmessage("Global eval: ", knitr::opts_chunk$get("eval")) # FALSE# This won't print anything although the `eval` is set to `TRUE` in this chunkflextable_to_rmd(ft)```
I suspect the issue stems from how flextable_to_rmd handles chunk options, possibly around lines 100-105 in the source code, where it might not properly account for local settings over global defaults. Ideally, it would respect the local chunk options setting even when the global option is set differently. Currently, the echo option is hardcoded to FALSE, which seems appropriate; however, other relevant options should also be considered and passed accordingly.
I believe it would be beneficial if the chunk containing the flextable object could inherit the local chunk options in which it is executed. Perhaps, extracting these options from the current chunk with knitr::opts_chunk$get(...) or an equivalent method might resolve the issue. While it may not be necessary to pass all chunk options to the child chunk, the eval option at least should be considered.
I am including my sessionInfo() output as advised, to provide details on my R environment and package versions.
I have checked both open and closed issues and updated to the latest package version to ensure this issue is not already addressed.
Thank you for looking into this, and I appreciate any guidance or corrections if my understanding is incorrect.
Hi!
First, thank you for your continuous efforts in developing this package; it's excellent!
I've recently encountered a potential bug with the
flextable_to_rmd function
in version0.9.6
. It appears that local Rmarkdown chunk options are ignored by this function, leading to potential issues. This wasn't a problem before0.9.6
.See a minimal reproducible example below where that issue causes the table not to be displayed because the local
eval
option is ignored.I suspect the issue stems from how
flextable_to_rmd
handles chunk options, possibly around lines 100-105 in the source code, where it might not properly account for local settings over global defaults. Ideally, it would respect the local chunk options setting even when the global option is set differently. Currently, theecho
option is hardcoded toFALSE
, which seems appropriate; however, other relevant options should also be considered and passed accordingly.I believe it would be beneficial if the chunk containing the flextable object could inherit the local chunk options in which it is executed. Perhaps, extracting these options from the current chunk with
knitr::opts_chunk$get(...)
or an equivalent method might resolve the issue. While it may not be necessary to pass all chunk options to the child chunk, the eval option at least should be considered.I am including my
sessionInfo()
output as advised, to provide details on my R environment and package versions.I have checked both open and closed issues and updated to the latest package version to ensure this issue is not already addressed.
Thank you for looking into this, and I appreciate any guidance or corrections if my understanding is incorrect.
The text was updated successfully, but these errors were encountered: