【问题标题】:ReporteRs crashing Rstudio记者让 Rstudio 崩溃
【发布时间】:2016-01-19 02:14:36
【问题描述】:

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

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是之前开发的条形图

谢谢!

【问题讨论】:

  • 崩溃报告应发送至 RStudio。不要用反引号终止代码块。并且无法繁殖。只会报错:object 'Lengthplotfinal' not foundError in vector.pptx.graphic(doc = doc, fun = fun, pointsize = pointsize, : an error occured when executing plot function. 不在 RStudio 中运行,而是在 Mac GUI 中运行。
  • ReporteRs 现已弃用。您可能想看看我的新导出包,它使用官员作为后端轻松将图形导出到 Powerpoint,请参阅 cran.r-project.org/web/packages/export/index.htmlgithub.com/tomwenseleers/export

标签: r ggplot2 rstudio reporters


【解决方案1】:

我已经重现了您的错误并将您的 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" )

【讨论】:

    猜你喜欢
    • 2010-09-17
    • 2020-07-07
    • 1970-01-01
    • 2012-09-23
    • 1970-01-01
    • 2015-05-28
    • 2021-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多