Re: [R] question: DLL or EXE from R procedures

About this list Date view Thread view Subject view Author view Attachment view

From: Gabor Grothendieck (ggrothendieck@myway.com)
Date: Thu 25 Dec 2003 - 06:11:00 EST


Message-id: <20031224191100.CACBC3961@mprdmxin.myway.com>


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@pdf.com>
To: Uwe Ligges <ligges@statistik.uni-dortmund.de>
Cc: <r-help@stat.math.ethz.ch>,PaTa PaTaS <vanecekpavel2@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@stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Thu 01 Jan 2004 - 09:21:00 EST