0

我可以通过以下代码在 R 中渲染图表:

 output$example=renderChart2({
    p1 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'multiBarChart')
    p1
    })

现在,我想在 ppt 中做同样的事情。通过使用 ReporteRs 包。我尝试了下面的代码,但它不起作用

library(ReporteRs)
doc =pptx( )
doc <- addSlide(doc, "Two Content")
plotFunc<- function(){ nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'multiBarChart')
} 
doc <- addPlot(doc, fun =print, x = plotFunc)
writeDoc(doc, "r-2.pptx" )

谁能告诉我如何在 ppt 中渲染 rCharts。

4

0 回答 0