我正在尝试使用ReporteR在R中创建PowerPoint。我已经使用 ggplot2 创建了我的图表。我安装了ReporteR没有问题,我可以创建一个新的pptx,添加幻灯片和标题,但是当它到达addPlot
Rstudio在崩溃之前对其进行了一点处理,给我的消息R Studio中止并遇到致命错误。以前有人经历过吗?这是我的报告代码:
install.packages("ReporteRs")
library(ReporteRs)
WinR = pptx()
slide.layouts(WinR)
WinR = addSlide(WinR,"Title and Content")
WinR = addTitle(WinR, "Effect of Time on Total Root Length")
WinR = addPlot(WinR, Lengthplotfinal)`
Lengthplotfinal
是之前开发的条形图
谢谢!
我已经重现了您的错误,将您的addPlot
行更改为下面的行似乎有效。
请参阅 http://davidgohel.github.io/ReporteRs/addPlot.html 中的示例
library(ReporteRs)
library(ggplot2)
#example plot
c <- ggplot(mtcars, aes(factor(cyl))) + geom_bar()
WinR = pptx()
slide.layouts(WinR)
WinR = addSlide(WinR,"Title and Content")
WinR = addTitle(WinR, "Effect of Time on Total Root Length")
WinR = addPlot(doc = WinR, x = c, fun = print)
writeDoc( WinR, "example.pptx" )