[Rd] export C++ array to R

From: whizvast <whizvast_at_gmail.com>
Date: Sat, 18 Apr 2009 01:12:50 -0700 (PDT)

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.

R-devel_at_r-project.org mailing list
Received on Sat 18 Apr 2009 - 21:51:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 20 Apr 2009 - 09:31:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive