@@ -111,7 +111,7 @@ NumericVector xx(y.begin(), y.end());
111111NumericVector xx =
112112 NumericVector::create(1.0, 2.0, 3.0, 4.0);
113113NumericVector yy =
114- NumericVector::create(Named[ "foo"] = 1.0,
114+ NumericVector::create(Named( "foo") = 1.0,
115115 _["bar"] = 2.0);
116116 // _ short for Named
117117```
@@ -434,17 +434,18 @@ double zz = Rf_rnorm(0, 2);
434434# Environment
435435
436436``` cpp
437- // Obtain an R environment
438- Environment stats ("package: stats ");
439- Environment env( 2 ); // by position
440-
441437// Special environments
442438Environment::Rcpp_namespace ();
443439Environment::base_env ();
444440Environment::base_namespace ();
445441Environment::global_env ();
446442Environment::empty_env ();
447443
444+ // Obtain an R environment
445+ Environment stats ("package: stats ");
446+ Environment env( 2 ); // by position
447+ Environment glob = Environment::global_env();
448+
448449// Extract function from specific environment
449450Function rnorm = stats[ "rnorm"] ;
450451
@@ -457,7 +458,7 @@ std::string x = glob["x"];
457458glob.assign( "foo" , 3 );
458459int foo = glob.get( "foo" );
459460int foo = glob.find( "foo" );
460- CharacterVector names = glob.ls()
461+ CharacterVector names = glob.ls(TRUE )
461462bool b = glob.exists( "foo" );
462463glob.remove( "foo" );
463464
0 commit comments