Skip to content

Commit 31e5d34

Browse files
committed
minor vignette brush-up for updated pinp (latex) class used
1 parent 9e3261b commit 31e5d34

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2019-10-04 Dirk Eddelbuettel <[email protected]>
2+
3+
* vignettes/Rcpp-attributes.Rmd: Correct two unevaluated knitr C++
4+
chunks to mode 'Rcpp' rather than the (unregistered) C++ mode
5+
* vignettes/Rcpp-extending.Rmd: Minor white-space tweak to avoid
6+
paragraph-spacing warnings from latex and its mdframed style
7+
* vignettes/Rcpp-modules.Rmd: Idem
8+
* vignettes/Rcpp-sugar.Rmd: Idem
9+
110
2019-10-01 Dirk Eddelbuettel <[email protected]>
211

312
* DESCRIPTION (Version, Date): Roll minor version

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
\itemize{
2020
\item The \code{Rcpp-modules} vignette received a major review and
2121
edit (Riccardo Porreca in \ghpr{982}).
22+
\item Minor whitespace alignments and edits were made in three
23+
vignettes following the new \pkg{pinp} release (Dirk).
2224
}
2325
}
2426
}

vignettes/Rcpp-attributes.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ Rcpp attribute compilation will automatically generate a package R_init function
656656

657657
You may however want to add additional C++ code to the package initialization sequence. To do this, you can add the `[[Rcpp::init]]` attribute to functions within your package. For example:
658658

659-
```{cpp, eval = FALSE}
659+
```{Rcpp, eval = FALSE}
660660
// [[Rcpp::init]]
661661
void my_package_init(DllInfo *dll) {
662662
// initialization code here
@@ -665,7 +665,7 @@ void my_package_init(DllInfo *dll) {
665665

666666
In this case, a call to `my_package_init()` will be added to the end of the automatically generated R_init function within RcppExports.cpp. For example:
667667

668-
```{cpp, eval = FALSE}
668+
```{Rcpp, eval = FALSE}
669669
void my_package_init(DllInfo *dll);
670670
RcppExport void R_init_pkgname(DllInfo *dll) {
671671
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);

vignettes/Rcpp-extending.Rmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ input <- list( x = seq(1, 10, by = 0.5) )
134134
fx(input)
135135
```
136136

137-
The \pkg{Rcpp} converter function `Rcpp::as` and `Rcpp::wrap` have been
138-
designed to be extensible to user-defined types and third-party types.
137+
The \pkg{Rcpp} converter functions `Rcpp::as` and `Rcpp::wrap` are
138+
extensible to user-defined types and third-party types.
139139

140140
# Extending `Rcpp::wrap`
141141

@@ -266,7 +266,6 @@ class Foo{
266266
Foo(SEXP);
267267
}
268268
269-
270269
// this must appear after the specialization, or
271270
// specialization will not be seen by Rcpp types
272271
#include <Rcpp.h>

vignettes/Rcpp-modules.Rmd

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,10 @@ A simple usage example is provided below:
487487
mod <- Module("mod_formals", getDynLib(fx))
488488
norm <- mod$norm
489489
norm()
490-
norm(y = 2)
491490
norm(x = 2, y = 3)
492-
args(norm)
493491
```
494492

495-
To set formal arguments without default values, simply omit the rhs.
493+
To set formal arguments without default values, omit the rhs.
496494

497495
```{Rcpp mod_formals2, eval=FALSE}
498496
using namespace Rcpp;
@@ -517,7 +515,7 @@ args(norm)
517515
```
518516

519517
The ellipsis (`...`) can be used to denote that additional arguments
520-
are optional; it does not take a default value.
518+
are optional; it does not take a default value.
521519

522520
```{Rcpp mod_formals3, eval=FALSE}
523521
using namespace Rcpp;
@@ -533,15 +531,14 @@ RCPP_MODULE(mod_formals3) {
533531
}
534532
```
535533

536-
and from the \proglang{R} side:
534+
This works similarly from the \proglang{R} side where the ellipsis is also understood:
537535

538536
```{r, eval=FALSE}
539537
mod <- Module("mod_formals3", getDynLib(fx))
540538
norm <- mod$norm
541539
args(norm)
542540
```
543541

544-
545542
## Exposing \proglang{C++} classes using Rcpp modules
546543

547544
Rcpp modules also provide a mechanism for exposing \proglang{C++} classes, based

vignettes/Rcpp-sugar.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,9 @@ sapply(const Rcpp::VectorBase<RTYPE,_NA_,T>& t,
688688
689689
### The sapply function
690690
691-
`sapply` is a template function that takes two arguments.
692-
693-
- The first argument is a sugar expression, which we recognize because of
694-
the relationship with the `VectorBase` class template.
695-
- The second argument is the function to apply.
691+
`sapply` is a template function that takes two arguments. The first argument is a sugar
692+
expression, which we recognize because of the relationship with the `VectorBase` class
693+
template. The second argument is the function to apply.
696694
697695
The `sapply` function itself does not do anything, it is just used
698696
to trigger compiler detection of the template parameters that will be used
@@ -712,6 +710,7 @@ typedef typename
712710

713711
The `result_of` type trait is implemented as such:
714712

713+
715714
```{Rcpp, eval = FALSE}
716715
template <typename T>
717716
struct result_of{
@@ -769,7 +768,7 @@ typedef typename
769768

770769
### Input expression base type
771770

772-
The input expression --- the expression over which `sapply` runs --- is
771+
The input expression---the expression over which `sapply` runs---is
773772
also typedef'ed for convenience:
774773

775774
```cpp
@@ -800,6 +799,7 @@ is the manifestation of the _CRTP_.
800799
801800
### Constructor
802801
802+
803803
The constructor of the `Sapply` class template is straightforward, it
804804
simply consists of holding the reference to the input expression and the
805805
function.

vignettes/figures/bootstrap.pdf

70 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)