Hi Dirck, Thanks for your answer.
I did not take care that in a Rcpp list when I access to the element like this algoOptions_["nbTry"] I get a SEXP element Thanks Serge Le 17.06.2011 13:30, Dirk Eddelbuettel a écrit :
[resending, this time with CC to list. --Dirk] Hi Serge, On 17 June 2011 at 09:56, Serge Iovleff wrote: | How can I test if a member of a list is a NULL value ? Recall that Rcpp is 'merely' a higher-level C++ interface playing along and on top of the R API itself --- so for questions like this check the R headers, documentation and 'Writing R Extensions' manual. In this case, per the Rinternals.h header: /* Various tests with macro versions below */ Rboolean (Rf_isNull)(SEXP s); Rboolean (Rf_isSymbol)(SEXP s); Rboolean (Rf_isLogical)(SEXP s); Rboolean (Rf_isReal)(SEXP s); Rboolean (Rf_isComplex)(SEXP s); Rboolean (Rf_isExpression)(SEXP s); Rboolean (Rf_isEnvironment)(SEXP s); Rboolean (Rf_isString)(SEXP s); Rboolean (Rf_isObject)(SEXP s); so Rf_isNull( someSexpVar ) is what you want. Works for any SEXP whether you access it as a single var, or pick it from a list. Hope this helps, Dirk
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
