Dav*_*vid 0 r ggplot2 rstudio reporters
我正在尝试使用ReporteRs在R中创建一个PowerPoint。我已经使用ggplot2创建了图形。我安装了ReporteR时没有问题,可以创建一个新的pptx,添加一张幻灯片和标题,但是当它进入addPlotRstudio时,它在崩溃前就可以工作了,给了我这样的消息,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)`
Run Code Online (Sandbox Code Playgroud)
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" )
Run Code Online (Sandbox Code Playgroud)