[Rcpp-devel] Dynamic Wrapping and Recursion with Rcpp - using an R function?

Romain Francois romain at r-enthusiasts.com
Sat Jul 27 13:19:16 CEST 2013


Le 27/07/13 13:06, Tal Galili a écrit :
> Hi Romain,
>
> Originally I hoped to be able to "get around" writing various functions
> in C++, by having Rcpp wrap an R function. But after Krzysztof
> explanation, and yours, I realized it would not offer any gain (due to
> the copying of objects all around).
>
> In which case, I am back to the original plan of finding the functions
> I'll need and write them in Rcpp.
> The most basic example of such a function is for getting and setting the
> labels of a dendrogram.
> labels.dendrogram is in base R, and I already have the function:
> "labels<-.dendrogram"
> In: https://github.com/talgalili/dendextend/blob/master/R/labels.r
> But these are SLOW functions.
> So my hope is to write them in Rcpp - them, and some other functions I'm
> playing with. Since ALL of these functions have the basic same
> structure, so once I'll have one nailed down, the rest will be easy.
>
> If you or anyone else wishes to help write that first function, that
> would be great.

We can help by giving advice on code you write. We're not writing your 
code :)

> Otherwise, I'll probably get to it once I finish
> uploading, tidying, and documenting all of my other functions (I have
> quite a bunch of them in the pipeline, before I'll get to optimizing
> them through Rcpp).

Good luck.

> Thank you (and the rest) for the answers, I am learning a lot,
> Tal

This is quite a difficult project to get started on using Rcpp. But 
OTOH, if you succeed at implementing it, you'll have useful skills for 
later projects.


> On Sat, Jul 27, 2013 at 1:52 PM, Romain Francois
> <romain at r-enthusiasts.com <mailto:romain at r-enthusiasts.com>> wrote:
>
>     C++ function that would start by creating a clone of your list,
>     using clone<List>.
>     - from this call a C++ function to recurse.
>     - for the actua
>
>
>
>
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com <mailto:Tal.Galili at gmail.com> |
> Read me: www.talgalili.com <http://www.talgalili.com> (Hebrew) |
> www.biostatistics.co.il <http://www.biostatistics.co.il> (Hebrew) |
> www.r-statistics.com <http://www.r-statistics.com> (English)
> ----------------------------------------------------------------------------------------------
>


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

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://blog.r-enthusiasts.com
|- http://bit.ly/13SrjxO : highlight 0.4.2
`- http://bit.ly/10X94UM : Mobile version of the graph gallery



More information about the Rcpp-devel mailing list