[R] again, a question between R and C++

From: Molins, Jordi <Jordi.Molins_at_drkw.com>
Date: Thu 21 Jul 2005 - 17:25:20 EST

Dear R Users,

I want to make a call from R into C++. My inputs are List1, List2, List3, IntegerID. The amount of elements of the lists and their type depend on IntegerID. Typical elements of a given list can be vectors, doubles, and even other lists. I want to return also a list (whose nature will depend also, possibly, on IntegerID).

What I want to do is to call these 4 inputs from C++ and then use a factory pattern (depending on IntegerID) that will perform different calculations on the lists depending on the IntegerID (of course, I could also do this with a simple switch statement).

I have been reading the documentation, especially the one regarding .Call and .External, and it seems that my algorithm could be implemented, but the examples I have seen up to now are such that what occupies the place of my lists are just vectors (like in convolve4 example).

Is there an example where I could see how instead of a vector, a set of lists (with an unkown number of arguments, as well as unkown types) are used as inputs? I guess that the ideal would be that in the equivalent of the convolve4 function, my args would be "variant" type of lists, and then, after the factory pattern is called, and the correct class is registered (via IntegerID), this variant type is really "decomposed" into the individual types that compose the list (ie, vectors, doubles, ...). Of course, in the factory there should be as many "decomposing" algorithms as IntegerIDs, each creating a particular decomposition.

Also, how returning a list (whose nature will depend also, possibly, on IntegerID) should be handled?

Thank you in advance


The information contained herein is confidential and is inte...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 21 17:32:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:53 EST