Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix three bugs in quick ref vignette #933

Merged
merged 4 commits into from
Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-12-26 Zhuoer Dong <dongzhuoer@mail.nankai.edu.cn>
* vignettes/Rcpp-quickref.Rmd: fix three bugs: use `Named()`,
define `glob`, `glob.ls(TRUE)`. see #933


2018-12-01 Dirk Eddelbuettel <edd@debian.org>

* R/Attributes.R: Added new 'c++2a' plugin for '-std=c++2a'
Expand Down
13 changes: 7 additions & 6 deletions vignettes/Rcpp-quickref.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ NumericVector xx(y.begin(), y.end());
NumericVector xx =
NumericVector::create(1.0, 2.0, 3.0, 4.0);
NumericVector yy =
NumericVector::create(Named["foo"] = 1.0,
NumericVector::create(Named("foo") = 1.0,
_["bar"] = 2.0);
// _ short for Named
```
Expand Down Expand Up @@ -434,17 +434,18 @@ double zz = Rf_rnorm(0, 2);
# Environment

```cpp
// Obtain an R environment
Environment stats("package:stats");
Environment env( 2 ); // by position

// Special environments
Environment::Rcpp_namespace();
Environment::base_env();
Environment::base_namespace();
Environment::global_env();
Environment::empty_env();

// Obtain an R environment
Environment stats("package:stats");
Environment env( 2 ); // by position
Environment glob = Environment::global_env();

// Extract function from specific environment
Function rnorm = stats["rnorm"];

Expand All @@ -457,7 +458,7 @@ std::string x = glob["x"];
glob.assign( "foo" , 3 );
int foo = glob.get( "foo" );
int foo = glob.find( "foo" );
CharacterVector names = glob.ls()
CharacterVector names = glob.ls(TRUE)
bool b = glob.exists( "foo" );
glob.remove( "foo" );

Expand Down