Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-28 Thread Sergio Bra
Thanks for your useful comments, I am trying something like this in a R file (I have changed the name of my c++ method compared with the example above, now is called myMethodCpp in order to avoid conflicts with the R name's function): myClass$myMethod <- function(param1, param2 = 0L) { invisib

Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Dirk Eddelbuettel
On 26 October 2016 at 10:05, Hao Ye wrote: | In sum, the easiest may be to 'hide' the module and deal with this from the | R | side exposing both variants from there and then just calling the one you | have now. | | | I agree - though I don't think you even need two variants of

Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Hao Ye
> > In sum, the easiest may be to 'hide' the module and deal with this from > the R > side exposing both variants from there and then just calling the one you > have now. I agree - though I don't think you even need two variants of the C++ function if there's an R function to handle default argum

Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Dirk Eddelbuettel
On 26 October 2016 at 18:24, Sergio Bra wrote: | I need to execute something like this in R: | | R> res<-new(myClass) | R>res$myMethod(1000) | | So, when you say that I can manage it from the R side, are you talking about | programming that behaviour in a *.R file? In case of an affirmative answ

Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Sergio Bra
Hi Dirk, thanks for your answer. I have checked your RcppCNPy package, but as you say, there is not methods implemented, but free functions. I need to execute something like this in R: R> res<-new(myClass) R>res$myMethod(1000) So, when you say that I can manage it from the R side, are you talki

Re: [Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Dirk Eddelbuettel
On 26 October 2016 at 09:48, Sergio Bra wrote: | I am exposing a c++ class using Rcpp. It works fantastic, but my problem is how | to implement a method which has default params. I have the class: | | class myClass { | |     public: |      |         int myMethod(int param1, int param2 = 0); | }

[Rcpp-devel] Method with default params using RCPP_MODULE

2016-10-26 Thread Sergio Bra
I am exposing a c++ class using Rcpp. It works fantastic, but my problem is how to implement a method which has default params. I have the class: class myClass { public: int myMethod(int param1, int param2 = 0); } and I config the module: RCPP_MODULE(mymodule) { class_("myClass