It works, thanks a lot!
Qiang Kou 于2016年11月11日 周五09:07写道:
> Hi, Jingyu,
>
> I post a small example below. I think this is what you want.
>
> Best,
>
> KK
>
> #include
>
> using namespace Rcpp;
>
> //[[Rcpp::export]]
> void test(Nullable f = R_NilValue) {
> if (f.isNotNull()) {
> Rcpp::Rcout
Hi, Jingyu,
I post a small example below. I think this is what you want.
Best,
KK
#include
using namespace Rcpp;
//[[Rcpp::export]]
void test(Nullable f = R_NilValue) {
if (f.isNotNull()) {
Rcpp::Rcout << "Not NULL fun" << std::endl;
Function f2(f);
f2();
} else {
Rcout <
On 11 November 2016 at 05:53, Jingyu He wrote:
| I've deleted the post on StackOverflow. Sorry for the ambiguity, the problem
is
| not arg, but the Function f.
|
|
| #include
| using namespace Rcpp;
| // [[Rcpp::export]]
| RObject cppfunction(Function rfunction = NULL) {
| if( rfunction
Hi,
I've deleted the post on StackOverflow. Sorry for the ambiguity, the
problem is not arg, but the Function f.
#include
using namespace Rcpp;
// [[Rcpp::export]]
RObject cppfunction(Function rfunction = NULL) {
if( rfunction == NULL){
cout << 1 + 1 << endl; // if we don't pass rf
On 11 November 2016 at 05:16, Jingyu He wrote:
| I'm writing a R package by Rcpp and I have a problem when setting default
value
| when call a R function in Rcpp. Here is an example to pass a R function to
C++,
| provided by http://adv-r.had.co.nz/Rcpp.html
|
| #include
| using namespace Rcpp;
Hi,
I'm writing a R package by Rcpp and I have a problem when setting default
value when call a R function in Rcpp. Here is an example to pass a R
function to C++, provided by http://adv-r.had.co.nz/Rcpp.html
#include using namespace Rcpp;// [[Rcpp::export]]RObject
callWithOne(Function f) {
re