eoffice包用法

eoffice包的官方说明文档如下

Provides wrap functions to export and import graphics and data frames in R to 'microsoft' office. And This package also provide write out figures with lots of different formats. Since people may work on the platform without GUI support, the package also provide function to easily write out figures to lots of different type of formats. Now this package provide function to extract colors from all types of figures and pdf files.

从说明看出,这个包不仅可以把当前画板的图或者ggplot2的图保存为PPTX格式,而且还有读入及输出office各种的常用格式,以下仅简单介绍常用的方法

#载入包及数据集
library(eoffice)
library(ggpubr)
attach(mtcars)
df <- mtcars
#绘制小提琴图
p<- ggviolin(df,
         x="cyl",
         y="wt",
         color = "cyl",
         fill = "cyl",
         palette = "jco")
p#画板显示图
topptx(p,"violin.pptx")#存入当前工作目录并命名
画板图片

工作目录有了文件

点取消组合按键可以单独编辑对象

显示可编辑对象

推荐阅读更多精彩内容