Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-17 Thread Tal Galili
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: use

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Tal Galili
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 libe

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Kevin Ushey
Just a suggestion re: recursion with Rcpp, yet another nice way we can recurse is through using the sugar lapply: - #include using namespace Rcpp; // [[Rcpp::export]] RObject add_attr(RObject x_) { RObject x = clone(x_); if (is(x)) { x = wrap( lapply( as(x), add_attr ) ); } else {

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Romain Francois
Le 16/08/13 14:48, Tal Galili a écrit : Hello Dirk, Your modifications/corrections are VERY helpful, thank you! (also, thank you for the general kind words and ongoing support, they are much appreciated) One more question/improvement - is it possible to have it return whatever value is inside th

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Romain Francois
Le 16/08/13 16:19, Dirk Eddelbuettel a écrit : Hi Tal, On 16 August 2013 at 15:48, Tal Galili wrote: | Hello Dirk, | Your modifications/corrections are VERY helpful, thank you! (also, thank you | for the general kind words and ongoing support, they are much appreciated) | | One more question/im

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Dirk Eddelbuettel
Hi Tal, On 16 August 2013 at 15:48, Tal Galili wrote: | Hello Dirk, | Your modifications/corrections are VERY helpful, thank you! (also, thank you | for the general kind words and ongoing support, they are much appreciated) | | One more question/improvement - is it possible to have it return wha

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Tal Galili
Hello Dirk, Your modifications/corrections are VERY helpful, thank you! (also, thank you for the general kind words and ongoing support, they are much appreciated) One more question/improvement - is it possible to have it return whatever value is inside the "label" attr? For example, running the

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-16 Thread Dirk Eddelbuettel
Tal, You were close. The error you got indicated that some of (our) wrapping around (our) class String was missing somehow. String is pretty new; Romain just added it a few month ago under funding by Hadley -- and I am still pretty unfamiliar with it. Which is why I always go back to std::stri

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-08-15 Thread Tal Galili
Dear Romain, and other Rcpp-devel members. I need some help. I've looked into the code Romain posted a few weeks ago, and I see that I can't change the example from working on double to working on String. I keep running into the error of: no matching function for call to 'range_wrap_dispatch__impl

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-23 Thread Tal Galili
Thanks Romain and Dirk! I am currently (slowly) working on developing a package where I would need some of these skills for specific bottleneck functions. I will get to the stage of using your code probably in something between 2 to 5 weeks (I hope). Once I reach it I will gladly share my progress.

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-23 Thread Romain Francois
Hello Tal, I'm trying to express this with the tools available in Rcpp 0.10.3. (And adding some tools for later versions too, like is<>). Here is how I would do the first problem: First break down into functions. We need : - something that tells me if a given R object is a list. With Rcpp de

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-21 Thread Dirk Eddelbuettel
On 21 July 2013 at 19:11, Tal Galili wrote: | Thank you Romain and Wush. | | Where from can I get the latest version of Rcpp with these new features? SVN checkout from R-Forge, as always. The is<> stuff isn't finished, though. SVN head is not that far ahead of CRAN's 0.10.4. | And how may I le

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-21 Thread Dirk Eddelbuettel
On 21 July 2013 at 10:56, Wush Wu wrote: | Hi Tal, | | > That is, say that we have x as a List, how do we go about fetching its attr? | > I tried: | > x[1].attr("type") | > x.attr[1]("type") | > But none seemed to have worked. Any suggestions there? | | Here is a script to show you how to access

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-21 Thread Tal Galili
Thank you Romain and Wush. Where from can I get the latest version of Rcpp with these new features? And how may I learn how to use them? Many thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | Read me: www.ta

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-21 Thread Romain Francois
Hi Tal, I'm travelling right now, i'll give some additional pointers later. This is a nice non trivial example, and i hope that the code îve put in recently (with is<>) can help you so that you dont have to use TYPEOF for dispatching. Our exchange at useR is part of my motivation for adding

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Wush Wu
Hi Tal, > That is, say that we have x as a List, how do we go about fetching its attr? > I tried: > x[1].attr("type") > x.attr[1]("type") > But none seemed to have worked. Any suggestions there? Here is a script to show you how to access them: ```r x <- list(a = 1, b = 2, c = list(ca = 3, cb = 4

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Tal Galili
Thank you for all the responses Dirk. I will go through them one at a time to see what I can accomplish on my own. Further questions will follow in the next few weeks (I imagine). Cheers, Tal Contact Details:--- Contact me: tal

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Dirk Eddelbuettel
Hi Tal, On 20 July 2013 at 22:14, Tal Galili wrote: | Hello Dirk and others, | | Dirk -  | Thank you for the quick reply! | | Some responses: | | | 1) I looked at the Rcpp gallery. | The best I found was: | http://gallery.rcpp.org/articles/setting-object-attributes/ | (which already was avail

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Tal Galili
Hello Dirk and others, Dirk - Thank you for the quick reply! Some responses: 1) I looked at the Rcpp gallery. The best I found was: http://gallery.rcpp.org/articles/setting-object-attributes/ (which already was available in Hadley's book) And: http://gallery.rcpp.org/articles/modifying-a-data-f

Re: [Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Dirk Eddelbuettel
Hi Tal, And welcome! On 20 July 2013 at 19:44, Tal Galili wrote: | Hello dear Rcpp users, | | First - I'd like to say that I took Hadley and Romain's workshop at the useR | conference this year, and I am very excited about trying out Rcpp - this | project looks AMAZING. Your feedback (as conve

[Rcpp-devel] Help with accessing and manipulating List objects

2013-07-20 Thread Tal Galili
Hello dear Rcpp users, First - I'd like to say that I took Hadley and Romain's workshop at the useR conference this year, and I am very excited about trying out Rcpp - this project looks AMAZING. Second - this is my first post, and I apologize if my question is too basic. To my defense, I tried l