I am trying to create a powerpoint in R using ReporteRs. I've created my graphs using ggplot2. I installed ReporteRs without issue and I can create a new pptx, add a slide and title, but when it gets to the addPlot
Rstudio works on it a bit before crashing, giving me the message that R Studio aborted and encountered a fatal error. Has anyone experienced this before? Here is my code for the 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
is the bar graph developed prior
Thank you!
I've reproduced your error and changing your addPlot
line to the one below appears to work.
See the examples at 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" )