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

Molins, Jordi Jordi.Molins at drkw.com
Thu Jul 21 09:25:20 CEST 2005

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}}

More information about the R-help mailing list