记者崩溃 Rstudio

ReporteRs crashing Rstudio

我正在尝试使用 ReporteRs 在 R 中创建一个 powerpoint。我使用 ggplot2 创建了我的图表。我安装 ReporteRs 没有问题,我可以创建一个新的 pptx,添加幻灯片和标题,但是当它到达 addPlot 时,Rstudio 在崩溃之前对其进行了一些处理,给我的消息是 R Studio 中止并遇到了致命错误。有谁之前经历过这个吗?这是我的 ReporteRs 代码:

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" )