Hi folks, Is it possible to have Excel call a R function. If not, how about making Excel send off a command to call a R script and then read the result back into Excel. I know, I know, this should belong to some Excel forum, but i just try my luck here. Thanks in advance. Horace W. Tso
On Fri, 2007-06-01 at 08:50 -0700, Horace Tso wrote:> Hi folks, > > Is it possible to have Excel call a R function. If not, how about > making Excel send off a command to call a R script and then read the > result back into Excel. > > I know, I know, this should belong to some Excel forum, but i just try > my luck here. > > Thanks in advance. > > Horace W. TsoSee the R-Excel add-in linked from here: http://www.sciviews.org/_rgui/projects/RDcom.html HTH, Marc Schwartz
You might consider having R do everything: R can read the Excel sheet, do what needs to be done, and write the results to an Excel sheet. Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Horace Tso Sent: Friday, June 01, 2007 11:51 AM To: r-help at stat.math.ethz.ch Subject: [R] Excel calling R functions Hi folks, Is it possible to have Excel call a R function. If not, how about making Excel send off a command to call a R script and then read the result back into Excel. I know, I know, this should belong to some Excel forum, but i just try my luck here. Thanks in advance. Horace W. Tso ______________________________________________ R-help at stat.math.ethz.ch 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.
Horace Tso wrote:> > Is it possible to have Excel call a R function. If not, how about > making Excel send off a command to call a R script and then read the > result back into Excel. > > I know, I know, this should belong to some Excel forum, but i just > try my luck here. >You can always put R in loop, checking each second or minute for the _existence_ of a file. As soon as this file is create, run an R function, and output a file. Then, do the same in Excel: write a file (I _think_ this is possible with macros), enter into a loop waiting for the other file to be created, and procceed after that. Slow, but better than to use Excel alone :-) Alberto Monteiro
Marc Schwartz wrote:> On Fri, 2007-06-01 at 08:50 -0700, Horace Tso wrote: >> Hi folks, >> >> Is it possible to have Excel call a R function. If not, how about >> making Excel send off a command to call a R script and then read the >> result back into Excel. >> >> I know, I know, this should belong to some Excel forum, but i just try >> my luck here. >> >> Thanks in advance. >> >> Horace W. Tso > > > See the R-Excel add-in linked from here: > > http://www.sciviews.org/_rgui/projects/RDcom.html >Some of the files listed in the link on that page appear to be quite outdated. The following link brings you to the current portal of the R(D)COM server and the rcom package. http://sunsite.univie.ac.at/rcom/ See the Excel heading for your question. You might be interested as well by the recent OpenOffice.org plugin (heading OOo). HTH, Tobias -- Tobias Verbeke - Consultant Business & Decision Benelux Rue de la r?volution 8 1000 Brussels - BELGIUM +32 499 36 33 15 tobias.verbeke at businessdecision.com
And just for completeness for the thread, there is the RDCOMServer package which has a more general mechanism for making R functionality available to other applications that does not require writing R commands but uses the language independent spirit of DCOM. And it also allows event handlers for things like Excel actions to be written as R functions Tobias Verbeke wrote:> Marc Schwartz wrote: >> On Fri, 2007-06-01 at 08:50 -0700, Horace Tso wrote: >>> Hi folks, >>> >>> Is it possible to have Excel call a R function. If not, how about >>> making Excel send off a command to call a R script and then read the >>> result back into Excel. >>> >>> I know, I know, this should belong to some Excel forum, but i just try >>> my luck here. >>> >>> Thanks in advance. >>> >>> Horace W. Tso >> >> See the R-Excel add-in linked from here: >> >> http://www.sciviews.org/_rgui/projects/RDcom.html >> > > Some of the files listed in the link on that page appear > to be quite outdated. The following link brings you to > the current portal of the R(D)COM server and the > rcom package. > > http://sunsite.univie.ac.at/rcom/ > > See the Excel heading for your question. You might be > interested as well by the recent OpenOffice.org plugin > (heading OOo). > > HTH, > Tobias >-- Duncan Temple Lang duncan at wald.ucdavis.edu Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Bldg. fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA