如何使用 R 中的 reporteRs 将日期添加到 docx 文档?

How to add date to docx document using reporteRs in R?

我只能在 reporteRs 中找到有关将日期(最好是基于报告 运行 的当前日期)添加到 pptx 文档的信息。有没有办法将当前日期添加到 docx 文档?

谢谢!

尝试

library( ReporteRs )
mydoc = docx( )
mydoc = addParagraph( mydoc, value = as.character(Sys.time()), stylename = "Normal" )
mydoc = addParagraph( mydoc, value = as.character(Sys.Date()), stylename = "Normal" )
writeDoc( mydoc, file = tf <- tempfile(fileext = ".docx"))
shell.exec(tf)

pptx 有效 ​​just like that...