Re: [Rcpp-devel] How to set a default value when call a R function in Rcpp

2016-11-11 Thread Jingyu He
cpp") > > f_test <- function() { > + print("test fun") > + } > > test(f_test) > Not NULL fun > [1] "test fun" > > test() > NULL fun > */ > > > > > On Fri, Nov 11, 2016 at 7:18 AM, Dirk Eddelbuettel wrote: > > &g

Re: [Rcpp-devel] How to set a default value when call a R function in Rcpp

2016-11-10 Thread Jingyu He
et a default rfunction (something like NULL indicating not passing it). But RObject cppfunction(Function rfunction = NULL) doesn't work. How can I make it? Thanks! Best, Jingyu On Thu, Nov 10, 2016 at 11:41 PM Dirk Eddelbuettel wrote: On 11 November 2016 at 05:16, Jingyu He wrote: |

[Rcpp-devel] How to set a default value when call a R function in Rcpp

2016-11-10 Thread Jingyu He
ion f) { return f(1);} The question is, how to set the default value for f? I would like to have the choice to pass a function or not, like callWithOne(Function f = NULL) { // if pass f, run f(1) // else, run something else} Thanks! Best, Jingyu He ___