[Rcpp-devel] returning array from C

Romain Francois romain at r-enthusiasts.com
Tue Jun 11 21:01:46 CEST 2013


Le 11 juin 2013 à 20:54, Krzysztof Sakrejda <krzysztof.sakrejda at gmail.com> a écrit :

> On Tue, Jun 11, 2013 at 2:49 PM, Romain Francois
> <romain at r-enthusiasts.com> wrote:
>> 
>> Le 11 juin 2013 à 20:40, Steve Jaffe <sjaffe at riskspan.com> a écrit :
>> 
>>> On Tuesday, June 11, 2013 2:37 PM, Krzysztof Sakrejda wrote:
>>>>> Would you know of a simple example of writing a "reference class" that looks
>>>>> to R like a numeric vector?
>>>> 
>>>> I think all the examples I've written are too complicated to be useful
>>>> but as a simple example break it into two problems, first ignore the
>>>> Rcpp side and write everything for a ref class which just has a vector
>>>> as a member:
>>>> ...
>>> 
>>> Thanks! That's exactly what I was looking for.
>>> Steve
>> 
>> This will be quite a lot of work !!!
> 
> I'm sure we could just write a wrapper factory function that generates
> all that code, it's just boilerplate until you get to the calls for
> calling methods for whatever the XPtr points to....
> 
> Krzysztof

Maintaining the idea that this external pointer acts as a numeric vector without being one. 

What happens then you want its mean, its quantile or whatever. You essentially have to reimplement everything. 

So yes : can be done, but lots of work. 


More information about the Rcpp-devel mailing list