Hi all,

 

We currently faced a problem about how to pass a matrix with different
types to a COM function call thru the RDCOMClient asCOMArray().

 

As we all know that matrix in R can't hold of elements with different
types. So we managed to create a matrix of lists:

 

rates <- matrix(

             list("1y","2y","3y","4y","5y","7y","10y"

                  ,0.23,0.25,0.25,0.19,0.23,0.25,0.28

                 )

           , nrow=7, ncol=2, byrow=FALSE

           )

This preserves the type info, but each element in the matrix rates is
type of list.

 

Then we can add a *case* statement in the function R_create2DArray in
file converters.cpp:

 

VARIANT v;

...

case VECSXP:

          // Only get the first element.

          VariantInit(&v);

          R_convertRObjectToDCOM(VECTOR_ELT(obj, ctr), &v);

          el = (void*)&v;

          break;

 

May I ask if there is another way to work this around? 

If not, may I request to add this new feature to RDCOMClient?

 

 

Thanks,

Milo


PLEASE READ: The information contained in this e-mail is confidential.
If you are not an intended recipient of this e-mail you must not copy,
distribute or take any further action in reliance upon it and you
should delete it and notify the sender.  E-mail is not a secure method
of communication.  Nomura Securities Co. Ltd Shanghai Representative
Office cannot accept responsibility for the accuracy or completeness of
this message or any attachment(s).  This transmission could contain
viruses, be corrupted, destroyed, incomplete, intercepted, lost or
arrive late.  If verification of this e-mail is sought then please
request a hard copy.  Unless otherwise stated any views or opinions
presented are solely those of the author and do not represent those of
Nomura Securities Co. Ltd Shanghai Representative Office.  This e-mail
is intended for information purposes only and is not a solicitation or
offer to buy or sell securities or related financial instruments.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to