Skip to content

Commit e44c6fa

Browse files
authored
Merge pull request #933 from dongzhuoer/patch-1
fix three bugs in quick ref vignette
2 parents 0664c1a + e82a65c commit e44c6fa

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2018-12-26 Zhuoer Dong <[email protected]>
2+
* vignettes/Rcpp-quickref.Rmd: fix three bugs: use `Named()`,
3+
define `glob`, `glob.ls(TRUE)`. see #933
4+
5+
16
2018-12-01 Dirk Eddelbuettel <[email protected]>
27

38
* R/Attributes.R: Added new 'c++2a' plugin for '-std=c++2a'

vignettes/Rcpp-quickref.Rmd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ NumericVector xx(y.begin(), y.end());
111111
NumericVector xx =
112112
NumericVector::create(1.0, 2.0, 3.0, 4.0);
113113
NumericVector 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
442438
Environment::Rcpp_namespace();
443439
Environment::base_env();
444440
Environment::base_namespace();
445441
Environment::global_env();
446442
Environment::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
449450
Function rnorm = stats["rnorm"];
450451

@@ -457,7 +458,7 @@ std::string x = glob["x"];
457458
glob.assign( "foo" , 3 );
458459
int foo = glob.get( "foo" );
459460
int foo = glob.find( "foo" );
460-
CharacterVector names = glob.ls()
461+
CharacterVector names = glob.ls(TRUE)
461462
bool b = glob.exists( "foo" );
462463
glob.remove( "foo" );
463464

0 commit comments

Comments
 (0)