[R] Exporting Numerous Graphs

Henrique Dallazuanna
Mon, 14 Sep 2009 12:23:50 -0000

Try this:


library(RDCOMClient)

w <- COMCreate('Word.Application')
w[["Visible"]] <- TRUE
w[["DisplayAlerts"]] <- FALSE
doc <- w$Documents()$Add(Template="Normal", NewTemplate=FALSE,
DocumentType=0)

fooPasteGraphs <- function(index, ...){
    win.metafile()
    plot(rnorm(100))
    dev.off()
    w$Selection()$Paste()
}

lapply(1:27, fooPasteGraphs)

doc$SaveAs(FileName = "graphs.doc", FileFormat =
"wdFormatDocument")

doc$Close()
w$Quit()

doc <- w <- NULL
rm(doc, w)



On Mon, Sep 14, 2009 at 2:55 AM, Chris Li
<chrisli@austwaterenv.com.au>wrote:

>
> Hi all,
>
> I have got 27 graphs to export (not a lot...I know!). How can I fit all of
> them into a single file like PNG without adjusting the size of the graphs?
> What's in my mind is like pasting graphs into Word, in which I can just
> scroll down to view the graphs.
>
> Thanks for your attention. Much appreciated.
>
> Chris
> --
> View this message in context:
> http://www.nabble.com/Exporting-Numerous-Graphs-tp25430649p25430649.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]