[Rcpp-devel] Method with default params using RCPP_MODULE

Sergio Bra sergio.bra88 at gmail.com
Fri Oct 28 23:10:31 CEST 2016


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) {
    invisible(.Call('myMethodCpp', PACKAGE = 'mypackage', param1, param2))
}

but when I compile the code I get the error:

    objet 'myClass' not found

Do you know how can I fix it? Is there a package which does something
similar?

Thank you very much,

Sergio

2016-10-26 19:10 GMT+02:00 Dirk Eddelbuettel <edd at debian.org>:

>
> 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 the C++
> function
> | if there's an R function to handle default arguments.
>
> Good catch, and sloppy wording on my part.  This is what I meant.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20161028/8c96b600/attachment.html>


More information about the Rcpp-devel mailing list