MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / exists

Function exists

inst/include/Rcpp/Environment.h:163–172  ·  view source on GitHub ↗

* Indicates if an object called name exists in the * environment * * @param name name of the object * * @return true if the object exists in the environment */

Source from the content-addressed store, hash-verified

161 * @return true if the object exists in the environment
162 */
163 bool exists( const std::string& name ) const {
164 SEXP nameSym = Rf_install(name.c_str());
165#if R_VERSION < R_Version(4,5,0)
166 SEXP res = Rf_findVarInFrame( Storage::get__() , nameSym ) ;
167 return res != R_UnboundValue;
168#else
169 SEXP res = R_getVarEx(nameSym, Storage::get__(), FALSE, NULL);
170 return res != NULL;
171#endif
172 }
173
174 /**
175 * Attempts to assign x to name in this environment

Callers 6

assignFunction · 0.85
removeFunction · 0.85
lockBindingFunction · 0.85
unlockBindingFunction · 0.85
bindingIsLockedFunction · 0.85
bindingIsActiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected