[Rcpp-devel] Calling an internal do_* C level function

Romain Francois romain at r-enthusiasts.com
Mon Oct 14 22:24:43 CEST 2013


Le 14/10/13 21:47, Mark Fredrickson a écrit :
> Thank you to Romain and Dirk. I've seen some C++ rank implementations,
> and I'll probably copy one of those.
>
>     Lastly, not a milligram of Rcpp in this question. Plain R programming
>     questions should go to r-devel, not rcpp-devel.
>
>
> Noted. My apologies. I was hoping there was some magic/sugar for this
> particular problem that I had missed in the docs. Perhaps something that
> negotiated the look up table that R uses for these functions.
>
> -M

Here comes the magic.

The internal function table (R_FunTab) is not hidden. With a bit of 
copying from R's unexported Defn.h, you can get the function pointer for 
the internal rank. see this gist: 
https://gist.github.com/romainfrancois/6981372

However, if you do this in a package, there is a good chance R CMD check 
will moan about it because you use R_FunTab.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30



More information about the Rcpp-devel mailing list