主要package:"officer", 说明文档:https://www.rdocumentation.org/packages/officer/versions/0.3.2
导出vector graph时,需用到辅助packege:"rvg"(提供 ph_with_vg() 函数)
关于officer的使用一个非常详尽的文档:https://davidgohel.github.io/officer/index.html
示例代码:
###vector plot to PPT
library(officer)
# Create a new powerpoint document
doc <- read_pptx()
doc <- add_slide(doc, 'Title and Content', 'Office Theme')
# Add the plot (ph_with_vg : the plot input must be a ggplot obj)
library(rvg)
doc <- ph_with_vg(doc, ggobj = aDc_revalue, type = 'body')
# Write the document to a file
print(doc, target = 'plots.pptx')