[R] Image into Excel file from R

Erich Neuwirth erich.neuwirth at univie.ac.at
Sun Apr 25 23:44:57 CEST 2010


RExcel has a VBA command
InsertCurrentRPlot which will put the current R plot into an Excel file.
RExcel is an Excel addin and can be installed
through the package RExcelInstaller available on CRAN.



On 4/25/2010 8:11 PM, Hans-Peter Suter wrote:
>> I am aware of the various packages (xlsReadWrite, RODBC) to get data
>> frames into R, but I would like to copy images too.
> 
> The xlsReadWritePro version could do it (see code below). It's a
> shareware package, but if people need/ask for a gratis license I send
> it (please download and check ?xls.lic first; www.swissr.org). I'm
> just finishing 'some' :-) RUnit tests and a new version will be
> released tomorrow or after tomorrow.
> 
> Cheers,
> Hans-Peter
> 
> rfile.img <- sub("origData", "origImage", rfile, fixed = TRUE)
> wfile.img <- sub("tmpWriteData", "tmpWriteImage", wfile, fixed = TRUE)
> pics <- c("pic1.jpeg", "pic2.png", "pic3.bmp", "pic4.emf", "pic5.wmf",
> "pic.jpg")
> fpics <-  file.path(dirname(rfile), pics)
> 
> 
> ### test: image
> ### !!! tests have to be executed in sequencial order !!!
> 
> test.proImage.1write <- function() {
>     exc <- xls.open(rfile.img)
>     xls.image(exc, "set", fpics[1], "Pic1")
>     xls.image(exc, "set", fpics[2], "Pic2")
>     xls.image(exc, "set", fpics[3], "Pic3")
>     xls.image(exc, "set", fpics[4], "Pic4")
>     xls.image(exc, "set", fpics[5], "Pic5")
>     xls.image(exc, "set", fpics[6], c(17, 7, 20, 8))
>     xls.close( exc, file = wfile.img)
> 
>     res <- xls.image(wfile.img, "list")
>     checkIdentical(res, c("Grafik 1", fpics))
> }
> 
> ______________________________________________
> 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.
> 
> 

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459



More information about the R-help mailing list