[R] how to call R in delphi?

Earl F. Glynn efg at stowers-institute.org
Thu Jan 20 22:49:32 CET 2005


"Dieter Menne" <dieter.menne at menne-biomed.de> wrote in message
news:loom.20050119T121646-759 at post.gmane.org...
> To call R from Delphi, you may try
> http://www.menne-biomed.de/download/RDComDelphi.zip.

I downloaded this file and tried to compile the RDCom project using Delphi 5
and Delphi 7 but I get this message from both  compilers:

[Fatal Error] STATCONNECTORCLNTLib_TLB.pas(406): Could not create output
file 'c:\program
files\borland\delphi7\Twain\d5\dcu\STATCONNECTORCLNTLib_TLB.dcu'



The "\db\dcu" in the path in this error message was a bit curious so I
looked at

Project | Options | Directories/Conditionals



Unit output directory:

$(DELPHI)\Twain\d5\dcu



Search path:

$(DELPHI)\Compon;C:\D2Pr\CascCont\COMPON;$(DELPHI)\Source\Toolsapi



On my "vanilla" Delphi 5 and Delphi 7 installations all of the directories
for the Unit output directory and Search path are invalid for the RDCom.dpr
project.

If I delete the Unit output directory, I then get 17 compilation errors, all
like this:
[Error] RCom.pas(115): Undeclared identifier: 'VarType'
[Error] RCom.pas(141): Undeclared identifier: 'VarArrayDimCount'
[Error] RCom.pas(123): Undeclared identifier: 'VarArrayHighBound'
. . .

All of the above seems to happen whether or not I install
STATCONNECTORCLNTLib_TLB.pas and STATCONNECTORSRVLib_TLP.pas as components
(i.e., Component | Install Component | <browse to .pas file> | Open | OK |
Compile).  Am I supposed to do this at some point?

Can you give me any clues how to make this work?  Something seems to be
missing.

>   Example program showing use of R from Delphi.
>   Connecting to R via COM using Neuwirth's StatConnectorSrvLib
>   Uses RCom.pas, which is a simple Delphi wrapper for passing
>   commands, integer and double arrays.
>   See http://cran.r-project.org/contrib/extra/dcom
>   By:  dieter.menne at menne-biomed.de

I'm not sure I understand this either.  I went to
http://cran.r-project.org/contrib/extra/dcom

I read this documentation:
http://cran.r-project.org/contrib/extra/dcom/RSrv135.html

I downloaded and installed the R(COM) server (and rebooted)
http://cran.r-project.org/contrib/extra/dcom/RSrv135.exe

So, how I can I call "R" from Delphi using R(COM)?  Something seems to be
missing.

Duncan Murdoch's suggestion about direct calls to R.dll looks interesting,
but a complete working example would be nice.

Thanks for any help with this.

efg
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research




More information about the R-help mailing list