Passing an instance of RInside 'R' as a parameter between classes / methods

I used Rcpp and RInside to integrate R and C ++ . We have a complex but well-designed C ++ architecture, and it's hard for me to access R with just one function. Is it possible to pass an instance Rto different classes / functions in order to get more OOP design? If so, are there any examples?

To develop a query, I want to say that something like this,

void foo(RInside& R0, int& x0)
{
 R0.assign(x0,"totalSum");
}
void foo2(RInside& R0, int& y0)
{
  R0.assign(y0,"temp");
   R0.parseEvalQ("totalSum = totalSum + temp"); 
 }
int main(int argc, char *argv[])
{   
  RInside R(int argc, char *argv[]);
  int x=10, y = 11;
  foo(R,x);
  foo2(R,y);
  return 0;
}

Currently, I notice that every call to foo possibly creates a new instance of RInside.

Thanks - Egon

+3
source share
1 answer

, , , rcpp-devel list ( , Rcpp RInside), RInside, Qt.

I instantiante R main(), , . , , R ( R ..), , Rserve.

SVN :

enter image description here

, , .., , .

+5

All Articles