如何导出(word或ppt)R中生成的可编辑图形?

如何导出(word或ppt)R中生成的可编辑图形?,r,ggplot2,graph,save,edit,R,Ggplot2,Graph,Save,Edit,我想将ggplot2或任何其他软件包生成的图形保存到word或ppt中的可编辑格式中。如何在R中执行此操作? 我用过 但显示相同的消息,即 Installing package into ‘C:/Users/ACER/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘ReporteRs’ is not available (for R version 3.

我想将ggplot2或任何其他软件包生成的图形保存到word或ppt中的可编辑格式中。如何在R中执行此操作? 我用过

但显示相同的消息,即

Installing package into ‘C:/Users/ACER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ReporteRs’ is not available (for R version 3.6.1)


Installing package into ‘C:/Users/ACER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘export’ is not available (for R version 3.6.1)
那么,是否有任何更新/顺利运行的程序包?

根据文档,ReporteRs程序包已重命名为officer

要安装

install.packages("officer") 

您也可以尝试eoffice软件包:

install.packages("eoffice")
ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
topptx(filename = file.path(tempdir(), "mtcars.pptx"))
## or todocx(filename = "mtcars.docx")
p <- ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
topptx(p, filename = file.path(tempdir(), "mtcars.pptx"), width = 6, height = 4)
install.packages("eoffice")
ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
topptx(filename = file.path(tempdir(), "mtcars.pptx"))
## or todocx(filename = "mtcars.docx")
p <- ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
topptx(p, filename = file.path(tempdir(), "mtcars.pptx"), width = 6, height = 4)