Unexpected Square Brackets in Word Output from R Markdown

Hello,

I'm experiencing an issue with R Markdown where square brackets [ ] are consistently appearing around the output when I knit to a Word document. This issue does not occur when knitting to HTML or PDF. I've tried several troubleshooting steps but haven't resolved the issue yet. Here are the details:

When I knit my R Markdown document to a Word file, the output from R code chunks is enclosed in square brackets. For example, output like summary(cars) that should appear as plain text shows up as [ Min. :4.0 1st Qu.:12.0 Median :15.0 Mean :15.4 3rd Qu.:19.0 Max. :25.0 ]. These brackets do not appear in HTML or PDF outputs.
Attempted Solutions:
Checked for field codes with Alt + F9 in Word (no field codes related to this issue).
Inspected and modified YAML and chunk options.
Updated all related R packages (knitr, rmarkdown).
Created minimal example R Markdown documents to isolate the problem.

Environment:

  • RStudio Version: (Version 2024.09.0+375)
  • R Version: ( R 4.4.1)
  • Operating System: (Apple M3, Sonoma 14.3)

I am wondering if anyone else has encountered this issue or has any suggestions on how to remove these unwanted square brackets in the Word output. Any advice or guidance would be greatly appreciated!

Thank you!