Skip to content
Back to formatted view

Raw Message

Message-ID: <296374.37638.qm@web27303.mail.ukl.yahoo.com>
Date: 2009-02-28T19:03:33Z
From: shkurta ahmeti
Subject: call lm function in R

Hello everybody,

i have to make a c++ programm, which calls the function lm() in R. Therefore i installed the rcpp-package. There were some examples too. 

I tried something, but i have the problem with the SEXP structure:

I want to call lm() without coming from R:

class MyVectorFunc : public RcppFunction {
public:
	MyVectorFunc() : RcppFunction( new SEXP(mkChar( "lm" )) {}

	double 
	funtkionsaufrufer( vector<double>& v )
	{
		setRVector(v);
		SEXP result = vectorCall();
		double value = REAL(result)[0];
		clearProtectionStack();
		return value;
	}
	

};


RcppFunction is from the Rcpp-package and this needs a SEXP-parameter. How can i create lm() as a SEXP parameter.

I m very thankful for every answer.

Bye