可以用R Officer输出特定样式的回归表吗?

Can R Officer Be Used to Output Regression Tables in a Specific Style?

我之前的理解是,使用 Microsoft Word Table 样式的能力仅在 officedown 包中可用,但语法如

read_docx(path = "reports/template.docx") %>%
body_add_flextable(my_ft) %>%
print(target = "reports/example_template.docx")

建议一些格式化 Word flextable 对象的能力,例如根据 Word 文档 Table 样式,那些将用于输出回归? officer 包中是否提供此功能?如果可以,我该如何使用它?

您可以使用 body_add_table():

doc <- read_docx()
doc <- body_add_table(doc, iris, style = "table_template")
print(doc, target = tempfile(fileext = ".docx") )

但是 flextable 对象不能与特定的 Word table 模板相关联。要设置 flextable 对象的样式,您只能使用 flextable 函数。