2016-01-19 36 views
0

我正在嘗試使用ReporteR在R中創建一個簡報。我使用ggplot2創建了我的圖。我安裝了ReporteR,沒有問題,我可以創建一個新的pptx,添加一個幻燈片和標題,但是當它到達addPlot Rstudio在崩潰之前有點工作,給我提示R Studio中止並遇到致命錯誤的消息。有誰之前經歷過這個嗎?這裏是我的記者代碼:ReporteR崩潰Rstudio

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是開發的條形圖之前

謝謝!

+0

報告應該去RStudio。不要用反引線終止代碼塊。並且不能重現。只有得到一個錯誤:vector.pptx.graphic(doc = doc,fun = fun,pointsize = pointsize,: 執行繪圖函數時發生錯誤。'object''Lengthplotfinal'not foundError不在RStudio中運行,而是在Mac GUI。 –

回答

4

我已經複製了您的錯誤,並將您的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")