问题: R语言使用export导出PPT格式报错。
Graphics API version mismatch
报错如下代码
> library(export)
> plot(1:3)
> graph2ppt(file = 'df.pptx', width = 6, height = 5)
> #返回: Error in PPTX_(file, bg, width, height, offx = offx, offy = offy, pointsize =pointsize,: 图形API版本不相符
解决方案:
搜索了好多,解决方法也不一样,但主要都是反映了依赖包的问题,例如重新安装了:rvg,ReporteRs,Cairo
最后我是重新安装了officer和对应的依赖包:
devtools::install_github('davidgohel/ReporteRsjars',force = T)
install.packages("officer")
install.packages("export")
# 解决了,可以导出了
plot(1:3)
export::graph2ppt(file = 'df.pptx', width = 6, height = 5)
# Exported graph as df.pptx
祝工作顺利,科研顺利。