[Rd] export C++ array to R

whizvast whizvast at gmail.com
Sat Apr 18 10:12:50 CEST 2009


Hi, I am a newbie on C++

Right now I have an array of doubles in C++.

Is there a way to "export" that array into R? Of course, I can allocate 
the memory block first using "allocVector" and copying the array contents 
one by one.

But, what if that array is fairly large? Copying doesn't look that
efficient.
I was thinking of setting the data pointer(DATAPTR) point to that array,
and adjust the LENGTH of SEXP. But I don't know how to do that.

Any comment/answer would be much appreciated. Thank you.
-- 
View this message in context: http://www.nabble.com/export-C%2B%2B-array-to-R-tp23110405p23110405.html
Sent from the R devel mailing list archive at Nabble.com.



More information about the R-devel mailing list