[R] export tables to Excel files

Erich Neuwirth erich.neuwirth at univie.ac.at
Wed Feb 24 00:01:15 CET 2010


In RExcel, you can write VBA macros to perform R-related function.
A cooked up example (not checked)

Sub TransferFrames()
  MySheetNames = Array("Sheet1", "Sheet2", "Sheet3")
  MyDFNames = Array("mydf1", "mydf2", "mydf3")
  RInterface.StartRServer
  For i = Lbound(MySheetNames) to UBound(MySheetNames)
  RInterface.PutDataframe MyDFNames(i), _
		Worksheets(MySheetNames(i)).Range("A1").CurrentRegion
  Next i
End Sub


This will take the data in the rectangular nonempty range
anchored at cell A1 for the 3 names sheets and transfer them
to R as dataframes with the names given in MyDFNames


On 2/23/2010 10:46 PM, Tal Galili wrote:
> Hi Richard,
> Thanks for pointing this out.
> 
> BTW - How would you use Rexcel to write several data frames into several
> sheets in excel ?
> 
> Thanks!
> 
> Tal
> 
> 
> 
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> ----------------------------------------------------------------------------------------------
> 
> 
> 
> 
> On Tue, Feb 23, 2010 at 5:04 PM, RICHARD M. HEIBERGER <rmh at temple.edu>wrote:
> 
>> Please consider RExcel, which allows complete integration of R and Excel.
>> See http://rcom.univie.ac.at
>> for details and examples including a video.
>> RExcel works in both directions (R to Excel, Excel to R) with
>> Excel 2010, 2007, 2003, and 2002.
>>
>> Rich
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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