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-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
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

[Rcpp-devel] NumericVector

2013-08-16 Thread James Li
Dear Dirk and Rcpp-devel members, I am currently passing a multidimensional (N > 2) array (i.e. array(NA, dim = rep(3,5)) ) from R via Rcpp using "in C++:" //[[Rcpp::export]] Rcpp::List check_arrayC (Rcpp::NumericVector x, Rcpp::IntegerVector modes){ //do stuff to x return Rcpp::List::create

Re: [Rcpp-devel] NumericVector

2013-08-16 Thread Dirk Eddelbuettel
Hi James, On 16 August 2013 at 11:59, James Li wrote: | Dear Dirk and Rcpp-devel members, | | I am currently passing a multidimensional (N > 2) array (i.e. | array(NA, dim = rep(3,5)) ) from R via Rcpp using How big is 'N' going to be? | "in C++:" | | //[[Rcpp::export]] | Rcpp::List check_ar

[Rcpp-devel] Using Rcpp in a package only as an option?

2013-08-16 Thread Tal Galili
Hello dear list members, Following previous correspondence, I wish to use an Rcpp function inside a package I'm authoring. However, I do not wish to force the user to install Rcpp, and if he does not wish to do so, I want to let him "fall back" on an R written function (which is 20-40 times slower

Re: [Rcpp-devel] NumericVector

2013-08-16 Thread Romain Francois
Le 16/08/13 17:59, James Li a écrit : Dear Dirk and Rcpp-devel members, Please be aware that Rcpp is a joint project and has been so for several years now. I am currently passing a multidimensional (N > 2) array (i.e. array(NA, dim = rep(3,5)) ) from R via Rcpp using "in C++:" //[[Rcpp::e

Re: [Rcpp-devel] Using Rcpp in a package only as an option?

2013-08-16 Thread Dirk Eddelbuettel
On 16 August 2013 at 19:36, Tal Galili wrote: | Hello dear list members, | | Following previous correspondence, I wish to use an Rcpp function inside a | package I'm authoring. | However, I do not wish to force the user to install Rcpp, and if he does not | wish to do so, I want to let him "fall

Re: [Rcpp-devel] Using Rcpp in a package only as an option?

2013-08-16 Thread Tal Galili
I suspected that this is the case. Will do - thanks. Contact Details:--- Contact me: tal.gal...@gmail.com | Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---

Re: [Rcpp-devel] NumericVector

2013-08-16 Thread James Li
Hi Dirk, N could be anywhere between 3-10. Thanks! I will definitely look into how to do those. Also, if Rcpp::NumericVector vec3 =Rcpp::NumericVector( Rcpp::Dimension(4, 5, 6)); In this case, how do we access element vec3[1,2,3]? Thanks again, James On Friday, August 16, 2013, Dirk Eddelbue

Re: [Rcpp-devel] NumericVector

2013-08-16 Thread Dirk Eddelbuettel
Hi James, On 16 August 2013 at 12:57, James Li wrote: | Hi Dirk, | | N could be anywhere between 3-10.  Eek. 10 is a lot. | Thanks! I will definitely look into how to do those. | | Also, if  | | Rcpp::NumericVector vec3 =Rcpp::NumericVector( Rcpp::Dimension(4, 5, 6)); | | In this case, how

Re: [Rcpp-devel] Using Rcpp in a package only as an option?

2013-08-16 Thread Romain Francois
Le 16/08/13 18:36, Tal Galili a écrit : Hello dear list members, Following previous correspondence, I wish to use an Rcpp function inside a package I'm authoring. However, I do not wish to force the user to install Rcpp, and if he does not wish to do so, I want to let him "fall back" on an R wri

Re: [Rcpp-devel] Default value for Rcpp List

2013-08-16 Thread Romain Francois
Le 14/08/13 16:25, Dirk Eddelbuettel a écrit : On 14 August 2013 at 15:57, Matteo Fasiolo wrote: | thank you very much for your replies. In the end a named vector is | enough for my purpose: | | cppFunction( | ' | NumericVector myVett(NumericVector x = NumericVector::create(0) ) | { | i

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 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] Default value for Rcpp List

2013-08-16 Thread Dirk Eddelbuettel
Hi Romain, On 16 August 2013 at 19:24, Romain Francois wrote: | Le 14/08/13 16:25, Dirk Eddelbuettel a écrit : | > | > | > On 14 August 2013 at 15:57, Matteo Fasiolo wrote: | > | thank you very much for your replies. In the end a named vector is | > | enough for my purpose: | > | | > | cppFuncti

Re: [Rcpp-devel] Default value for Rcpp List

2013-08-16 Thread Romain Francois
Le 16/08/13 19:33, Dirk Eddelbuettel a écrit : Hi Romain, On 16 August 2013 at 19:24, Romain Francois wrote: | Le 14/08/13 16:25, Dirk Eddelbuettel a écrit : | > | > | > On 14 August 2013 at 15:57, Matteo Fasiolo wrote: | > | thank you very much for your replies. In the end a named vector is |

Re: [Rcpp-devel] NumericVector

2013-08-16 Thread James Li
Hi Romain and Dirk, Sorry I did not see Romain's earlier response. That is very helpful! Thank you both for your prompt assistance and for developing such a useful tool. -James On Friday, August 16, 2013, Dirk Eddelbuettel wrote: > > Hi James, > > On 16 August 2013 at 12:57, James Li wrote:

[Rcpp-devel] Rcpp build trouble with strings

2013-08-16 Thread jacob.a.russell.th
Hello, I am trying to build a package but I have quite a few dependencies. As such, I have modified Makevars to be (I don't like backticks because I find them too similar to single quotes): PKG_LIBS = $($(R_HOME)/bin/Rscript -e 'Rcpp:::LdFlags()') -L. -llink_4_1b -lDGG -lSTR -lDLL -lAF -lmy_std

Re: [Rcpp-devel] Default value for Rcpp List

2013-08-16 Thread Dirk Eddelbuettel
On 16 August 2013 at 19:38, Romain Francois wrote: | It was me who missed something actually. I though you called | | matteo() No worries. I would have called that usage pattern out too! | To my defense, I'm still recovering from an insolation. Hope you get better soon. At least you have the

Re: [Rcpp-devel] Rcpp build trouble with strings

2013-08-16 Thread Dirk Eddelbuettel
On 16 August 2013 at 13:45, jacob.a.russell...@dartmouth.edu wrote: | Hello, | | I am trying to build a package but I have quite a few dependencies. As such, I | have modified Makevars to be (I don't like backticks because I find them too | similar to single quotes): | | PKG_LIBS = $($(R_HOME)/b

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 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] Using Rcpp in a package only as an option?

2013-08-16 Thread Hadley Wickham
> In most cases your package is going to be distributed as binary anyway, so > CRAN compiled it, and CRAN compiled Rcpp, so there should be nothing to > worry. And even if you're not distributing from source, telling (windows) users to install rtools and then use install_github is not a big barrie