* remove an object from this environment */
| 216 | * remove an object from this environment |
| 217 | */ |
| 218 | bool remove( const std::string& name ){ |
| 219 | if( exists(name) ){ |
| 220 | if( bindingIsLocked(name) ){ |
| 221 | throw binding_is_locked(name) ; |
| 222 | } else{ |
| 223 | /* unless we want to copy all of do_remove, |
| 224 | we have to go back to R to do this operation */ |
| 225 | SEXP internalSym = Rf_install( ".Internal" ); |
| 226 | SEXP removeSym = Rf_install( "remove" ); |
| 227 | Shield<SEXP> str(Rf_mkString(name.c_str())); |
| 228 | Shield<SEXP> call(Rf_lang2(internalSym, Rf_lang4(removeSym, str, Storage::get__(), Rf_ScalarLogical(FALSE)))); |
| 229 | Rcpp_fast_eval( call, R_GlobalEnv ) ; |
| 230 | } |
| 231 | } else{ |
| 232 | throw no_such_binding(name) ; |
| 233 | } |
| 234 | return true; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * locks this environment. See ?lockEnvironment |
no test coverage detected