[R] How to attach chart to excel file?
Henrique Dallazuanna
wwwhsd at gmail.com
Wed Jan 27 12:47:35 CET 2010
Try this:
library(RDCOMClient) # from omegahat.org
xl <- COMCreate("Excel.Application")
xl[["Visible"]] <- TRUE
xl[["DisplayAlerts"]] <- FALSE
wk <- xl$Workbooks()$Add()
tf <- tempfile()
png(tf)
plot(rnorm(100), type = 'l')
dev.off()
wk$ActiveSheet()$Pictures()$Insert(tf)
wk$SaveAs(gsub("/", "\\\\", file.path(getwd(), "test.xls")))
wk$Close()
xl$Quit()
xl <- NULL
On Wed, Jan 27, 2010 at 8:21 AM, johannes rara <johannesraja at gmail.com> wrote:
> Hi,
>
> How can I attach chart/plot to a excel file? I would like to create a
> plot in R eg.
>
> plot(1)
>
> and save it into a Excel file, eg. test.xls in a same working directory.
>
> Regrads,
> -J
>
> ______________________________________________
> R-help at 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
More information about the R-help
mailing list