Suppose I have a C++ code to compile with Rcpp and will be called in R.
// [[Rcpp::export]]
SEXP to_env(List x) {
if(x.hasAttribute("names"))
{
return x;
}
else
{
return NULL;
}
}
What should the NULL
value be to return R's NULL
instead of a crash?
Use this code: