Just to update everyone that I've found the bug in the package, and now the RcppDend package works fine. You can see the relevant commit here: https://github.com/talgalili/RcppDend/commit/25d456571f2f1e52f1f9aa8ac6bc3a7fcb832e65
The problem was that my NAMESPACE file was missing the two lines: useDynLib(RcppDend) exportPattern("^[[:alpha:]]+") The reason it was missing them was because I am using Rstudio+roxygen2, and had NAMESPACE editing turned on, and it appears to erase these lines. This had caused R to not find the Rcpp functions, and resulted in the error: Error in .Call("RcppDend_Rcpp_labels_dendrogram", PACKAGE = "RcppDend") : "RcppDend_Rcpp_labels_dendrogram " not available for .Call() for package "RcppDend" I have submitted a bug report for RStudio/roxygen2: http://support.rstudio.org/help/discussions/problems/8418-rcpp-packages-fails-when-using-roxygen2-to-handle-namespace https://github.com/klutometis/roxygen/issues/130 Future tweaks/commits/suggestions to RcppDend <https://github.com/talgalili/RcppDend>are most welcomed. Best, Tal ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Fri, Aug 16, 2013 at 9:48 PM, Tal Galili <tal.gal...@gmail.com> wrote: > Dear Dirk, Romain, Kevin, and others. > > Since I am currently actively working on extending the dendrogram object > in R, I have a real interest in finding and solving some of the major > bottlenecks of dendrogram manipulation. > Thank you all for all of your help and suggestions thus far. > > I took the liberty of starting a github repo for a new R package > "RcppDend", you can see it here: > https://github.com/talgalili/RcppDend > > It currently contains the function for label extraction from dendrogram (a > mixture of the code Romain and Dirk wrote, with some minor modifications by > me). > The Rcpp code is here: > https://github.com/talgalili/RcppDend/blob/master/src/labels_dendrogram.cpp > And the R code (wrapping it a bit, and adding documentation), is here: > https://github.com/talgalili/RcppDend/blob/master/R/RcppDend.r > > Currently, I can get the labels.dendrogram function to work when I'm > compiling it in a local session, but *the function fails to work when > loaded from this package*. If you have suggestions on how to fix it, I'd > be happy to read. > > And in general, I welcome any code contributions/commits. > > Best, > Tal > > > > > > > ----------------Contact > Details:------------------------------------------------------- > Contact me: tal.gal...@gmail.com | > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | > www.r-statistics.com (English) > > ---------------------------------------------------------------------------------------------- > > > > On Fri, Aug 16, 2013 at 9:04 PM, Kevin Ushey <kevinus...@gmail.com> wrote: > >> Just a suggestion re: recursion with Rcpp, yet another nice way we can >> recurse is through using the sugar lapply: >> >> ----- >> >> #include <Rcpp.h> >> using namespace Rcpp; >> >> // [[Rcpp::export]] >> RObject add_attr(RObject x_) { >> RObject x = clone(x_); >> if (is<List>(x)) { >> x = wrap( lapply( as<List>(x), add_attr ) ); >> } else { >> x.attr("type") = "Other"; >> } >> return x; >> } >> >> /*** R >> add_attr( list(x=list(a=1, b=2, c=3), y=list( list( d=4 ) ) ) ) >> */ >> >> ----- >> >> If we want to operate on specific elements as well, we can use is<T> and >> as<T> together, and then operate on objects as needed. >> >> It lets us avoid an explicit for loop, and 'feels' more like R. >> >> -Kevin >> > >
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel