[R] question: DLL or EXE from R procedures

Gabor Grothendieck ggrothendieck at myway.com
Wed Dec 24 20:11:00 CET 2003



Also, if its not necessary that it actually be a compiled
program then a batch file, linreg.bat, along with the
supporting R code file, linreg.r, and the data file, data.txt,
could be created like this (in Windows, modify for others):

--- linreg.bat -------------------------------------------------------
set infile=%1
"C:\Program Files\R\rw1081\bin\Rcmd.exe" BATCH linreg.R linreg.Rout

--- linreg.r -------------------------------------------------------
infile <- Sys.getenv("infile")
z <- read.table(infile, header=T)
with(z, lm(y ~ x))

--- data.txt -------------------------------------------------------
x y
1 2
2 4
3 7




Date: Wed, 24 Dec 2003 07:27:08 -0800 
From: Spencer Graves <spencer.graves at pdf.com>
To: Uwe Ligges <ligges at statistik.uni-dortmund.de> 
Cc: <r-help at stat.math.ethz.ch>,PaTa PaTaS <vanecekpavel2 at seznam.cz> 
Subject: Re: [R] question: DLL or EXE from R procedures 

 
 
While Uwe is correct about the absence of a compiler for R, one 
can call R from other languages such as C. A description of this can be 
found, e.g., from R 1.8.1, help.start() -> "Writing R Extensions" -> 
"Evaluating R expressions from C". Also, the many R functions actually 
call C code, which could be called directly. 

hope this helps. 
spencer graves 

Uwe Ligges wrote:

>PaTa PaTaS wrote:
> 
>
>>Hi,
>>I wonder if it is possible to create an DLL or EXE file performing R procedures. Instead of running R, reading data and calling some procedures, I would like to use R functions in the following way: "C:\linearRegression.exe data.txt" which would produce let's say file "output.txt" with the results. Is there some way how to do it?
>>Thanks a lot. Pavel Vanecek
>> 
>>
>
>No. There is not compiler for R code available.
>
>Uwe Ligges
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
>




More information about the R-help mailing list