Skip to content

Commit

Permalink
Fix typos in the vignettes (#1344)
Browse files Browse the repository at this point in the history
* Fix typos.

* Add ChangeLog entry.

* Standardise format of the last ChangeLog entry.
  • Loading branch information
mcol authored Nov 3, 2024
1 parent dbea570 commit 6193de5
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 41 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2024-11-03 Marco Colombo <mar.colombo13@gmail.com>

* vignettes/rmd/Rcpp-FAQ.Rmd: Fixed typos
* vignettes/rmd/Rcpp-attributes.Rmd: Idem
* vignettes/rmd/Rcpp-extending.Rmd: Idem
* vignettes/rmd/Rcpp-introduction.Rmd: Idem
* vignettes/rmd/Rcpp-libraries.Rmd: Idem
* vignettes/rmd/Rcpp-modules.Rmd: Idem
* vignettes/rmd/Rcpp-package.Rmd: Idem
* vignettes/rmd/Rcpp-quickref.Rmd: Idem
* vignettes/rmd/Rcpp-sugar.Rmd: Idem

2024-11-02 Dirk Eddelbuettel <edd@debian.org>

* tests/tinytest.R: Minor code edit, removal of two no longer
Expand Down
28 changes: 14 additions & 14 deletions vignettes/rmd/Rcpp-FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down Expand Up @@ -111,7 +111,7 @@ vignette("Rcpp-attributes")
```

If you do not have \pkg{Rcpp} installed, these documents should also be available
whereever you found this document, \textsl{i.e.,} on every mirror site of CRAN.
wherever you found this document, \textsl{i.e.,} on every mirror site of CRAN.

## What do I need

Expand Down Expand Up @@ -157,7 +157,7 @@ Specific per-platform notes:
Fortran-using packages are to be built); also see \faq{q:OSX} and
\faq{q:OSXArma} below. This is frustratingly moving target; consult
the \code{r-sig-mac} list (and its archives) for (current) details.
\item[Linux] user need to install the standard developement packages. Some
\item[Linux] user need to install the standard development packages. Some
distributions provide helper packages which pull in all the required
packages; the \texttt{r-base-dev} package on Debian and Ubuntu is an example.
\end{description}
Expand All @@ -181,7 +181,7 @@ exhaustive as CRAN by now has \textsl{many} helpful packages:
Attributes (see \faq{using-attributes} and
\faq{prototype-using-attributes}) feature provided by \pkg{Rcpp};
\item[\pkg{RUnit}, \pkg{tinytest}, \pkg{testthat}] can be used for unit
testing; \pkg{Rcpp} uses \pkg{tinytest} as it is ligthweight and installs the
testing; \pkg{Rcpp} uses \pkg{tinytest} as it is lightweight and installs the
tests along with the package by default but note that no testing package is
\textsl{required}: all are optional;
\item[\pkg{rbenchmark}, \pkg{microbenchmark}] to run simple timing
Expand Down Expand Up @@ -301,12 +301,12 @@ the supplied code and makes it available under the selected identifier.
Similarly, \rdoc{Rcpp}{sourceCpp} can read in a file and compile, link and load
the code therein.

## How do I convert my prototyped code to a package {#from-inline-to-package}
## How do I convert my prototype code to a package {#from-inline-to-package}

Since release 0.3.5 of \pkg{inline}, one can combine \faq{using-inline} and
\faq{make-package}. See `help("package.skeleton-methods")` once
\pkg{inline} is loaded and use the skeleton-generating functionality to
transform a prototyped function into the minimal structure of a package.
transform a prototype function into the minimal structure of a package.
After that you can proceed with working on the package in the spirit of
\faq{make-package}.

Expand Down Expand Up @@ -384,7 +384,7 @@ for you.
Note that we always need to set `PKG_CXXFLAGS` (or equally `PKG_CPPFLAGS`) to tell R
where the \pkg{Rcpp} headers files are located.

Once `R CMD SHLIB` has created the dyanmically-loadable file (with
Once `R CMD SHLIB` has created the dynamically-loadable file (with
extension `.so` on Linux, `.dylib` on macOS or `.dll` on
Windows), it can be loaded in an R session via \rdoc{base}{dyn.load}, and the
function can be executed via \rdoc{base}{.Call}. Needless to say, we
Expand Down Expand Up @@ -551,7 +551,7 @@ By now REvolution R is defunct too.

Rho, previously known as CXXR, is an ambitious project that aims to
totally refactor the \proglang{R} interpreter in \proglang{C++}. There
are a few similaritites with \pkg{Rcpp} but the projects are
are a few similarities with \pkg{Rcpp} but the projects are
unrelated.

Rho / CXXR and \pkg{Rcpp} both want \proglang{R} to make more use of \proglang{C++}
Expand Down Expand Up @@ -1110,7 +1110,7 @@ at some limit. We chose 20.

A good discussion is available at
[this StackOverflow question](http://stackoverflow.com/questions/27371543)
concering data.frame creation with \pkg{Rcpp}. One solution offers a custom
concerning data.frame creation with \pkg{Rcpp}. One solution offers a custom
`ListBuilder` class to circumvent the limit; another suggests to simply
nest lists.

Expand Down Expand Up @@ -1171,7 +1171,7 @@ But of course. In a nutshell, this boils down to \emph{what your compiler
[Rcpp Gallery article](http://gallery.rcpp.org/articles/rcpp-and-c++11-c++14-c++17/) providing more detail. What follows in an abridged summary.
You can always \emph{locally} set appropriate `PKG_CXXFLAGS` as an
environment variable, or via `~/.R/Makevars`. You can also plugins and/or R
environment variable, or via `~/.R/Makevars`. You can also set plugins and/or R
support from `src/Makevars`:
- _C++11_: has been supported since early 2013 via a plugin selecting
Expand Down Expand Up @@ -1239,7 +1239,7 @@ and all three formats are also available a zip-archives:

## Does it really work

We take quality seriously and have developped an extensive unit test suite to
We take quality seriously and have developed an extensive unit test suite to
cover many possible uses of the \pkg{Rcpp} API.

We are always on the look for more coverage in our testing. Please let us know
Expand Down Expand Up @@ -1452,7 +1452,7 @@ circumvented as it is really a pointer to the underlying R object.
## Issues with implicit conversion from an \pkg{Rcpp} object to a scalar or other \pkg{Rcpp} object

Not all \pkg{Rcpp} expressions are directly compatible with
`operator=`. Compability issues stem from many \pkg{Rcpp} objects and
`operator=`. Compatibility issues stem from many \pkg{Rcpp} objects and
functions returning an intermediary result which requires an explicit
conversion. In such cases, the user may need to assist the compiler
with the conversion.
Expand Down Expand Up @@ -1587,7 +1587,7 @@ There are three options to trigger compilation with \proglang{C++11}.
The first -- and most likely option to use -- will be the plugin support offered
by \pkg{Rcpp} attributes. This can be engaged by adding
`// [[Rcpp::plugins(cpp11)]]` to the top of the \proglang{C++} script.
For diagnostic and illustrativative purposes, consider the following code
For diagnostic and illustrative purposes, consider the following code
which checks to see if `R_xlen_t` is available on your platform:

```{Rcpp}
Expand Down Expand Up @@ -1732,7 +1732,7 @@ figure out what routines need to be registered. If an older `RcppExports.R` file
is discovered, its out-of-date symbol names get picked up, and registration
rules for those symbols get written as well. This will register more symbols for
the package than are actually defined, leading to an error. This point has been
discussed at some length both in the GitHub issue tickes, on StackOverflow and
discussed at some length both in the GitHub issue tickets, on StackOverflow and
elsewhere.

So if your autogenerated file fails, and a `symbols not found` error is reported
Expand Down
2 changes: 1 addition & 1 deletion vignettes/rmd/Rcpp-attributes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down
2 changes: 1 addition & 1 deletion vignettes/rmd/Rcpp-extending.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down
12 changes: 6 additions & 6 deletions vignettes/rmd/Rcpp-introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ output:
pinp::pinp:
collapse: true

# Local additiona of a few definitions we use
# Local additions of a few definitions we use
header-includes: >
\newcommand{\TODO}{\marginnote{TODO}}
\newcommand{\rlang}{\textit{R }}
Expand Down Expand Up @@ -144,7 +144,7 @@ statement is now added: _Interfaces to other software are part of \rlangns_.

This last addition is profound. If and when suitable and performant
software for a task exists, it is in fact desirable to have a (preferably
also perfomant) interface to this software from \rlangns.
also performant) interface to this software from \rlangns.
\cite{Chambers:2016:ExtR} discusses several possible approaches for simpler
interfaces and illustrates them with reference implementations to both \python\ and
\julia. However, the most performant interface for \rlang is provided at the
Expand All @@ -155,7 +155,7 @@ analysts and data scientists, aiming to enable them to use---and
create--- further _interfaces_ for \rlang which aid the _mission_ while
staying true to the _prime directive_. Adding interfaces in such a way is in
fact a natural progression from the earliest designs for its predecessor
\slang which was after all designed to provide a more useable 'interface' to
\slang which was after all designed to provide a more usable 'interface' to
underlying routines in \fortranns.

The rest of the paper is structured as follows. We start by discussing
Expand Down Expand Up @@ -188,7 +188,7 @@ elements can be obtained in different ways. Some of these are addressed in the _
the Rtools kit provided by R Core available at <https://cran.r-project.org/bin/windows/Rtools/>.
Details of these installation steps are beyond the scope of this
paper. However, many external resources exist that provide detailed
installation guides for \rlang toolschains in
installation guides for \rlang toolchains in
[Windows](http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/)
and
[macOS](http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-os-x/).
Expand Down Expand Up @@ -354,7 +354,7 @@ convolve_cpp(const NumericVector& a,

To deploy such code from within an \rlang script or session, first save it into a new
file---which could be called **convolve.cpp**---in either the working directory, a
temporary directoy or a project directory. Then from within the \rlang session,
temporary directory or a project directory. Then from within the \rlang session,
use `Rcpp::sourceCpp("convolve.cpp")` (possibly using a path as well as the filename). This
not only compiles, links and loads the code within the external file but also adds the
necessary "glue" to make the \rcpp function available in the \rlang environment. Once the
Expand Down Expand Up @@ -481,7 +481,7 @@ evalCpp("R::rnorm(0, 1)")

One important aspect of the behind-the-scenes code generation for the single expression
(as well as all code created via _Rcpp Attributes_) is the automatic preservation of the
state of the random nunber generators in \rlangns. This means that from a given seed, we will
state of the random number generators in \rlangns. This means that from a given seed, we will
receive _identical_ draws of random numbers whether we access them from \rlang or via \cpp code
accessing the same generators (via the \rcpp interfaces). To illustrate, the
same number is drawn via \rlang code after resetting the seed:
Expand Down
10 changes: 5 additions & 5 deletions vignettes/rmd/Rcpp-libraries.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ doi_footer: "https://arxiv.org/abs/1911.06416"

# Abstract
abstract: |
We desribe how we extend R with an external C++ code library by using the Rcpp
We describe how we extend R with an external C++ code library by using the Rcpp
package. Our working example uses the recent machine learning library and application
'Corels' providing optimal yet easily interpretable rule lists \citep{arxiv:corels}
which we bring to R in the form of the \pkg{RcppCorels} package
Expand Down Expand Up @@ -141,7 +141,7 @@ The first step in getting a new package combing R and C++ is often the creation
Rcpp package. There are several helper functions to choose from. A natural first choice
is `Rcpp.package.skeleton()` from the \pkg{Rcpp} package \citep{CRAN:Rcpp}. It can be
improved by having the optional helper package \pkg{pkgKitten} \citep{CRAN:pkgKitten}
around as its `kitten()` function smoothes some rougher edges left by the underlying Base
around as its `kitten()` function smooths some rougher edges left by the underlying Base
R function `package.skeleton()`. This step is shown below in then appendix, and
corresponds to the first commit, followed by a first edit of file `DESCRIPTION`.

Expand All @@ -154,7 +154,7 @@ it.

Given a basic package with C++ support, we can now turn to integrating the external
package. This complexity of this step can, as alluded to earlier, vary from very easy to
very complex. Simple cases include just dependending on library headers which can either
very complex. Simple cases include just depending on library headers which can either
be copied to the package, or be provided by another package such as \pkg{BH}
\citep{CRAN:BH}. It may also be a dependency on a fairly standard library available on
most if not all systems. The graphics formats bmp, jpeg or png may be example; text
Expand Down Expand Up @@ -243,7 +243,7 @@ fs::dir_tree("../../../rcppcorels/inst/sample_data")
## Set up working example

Combining the two preceding steps, we can now offer an illustrative example. It is
included in the helpd page for function `corels()` and can be run from R via
included in the help page for function `corels()` and can be run from R via
`example("corels")`.

```r
Expand Down Expand Up @@ -279,7 +279,7 @@ arguments default values are used.

## Finesse Library Dependencies

One common difficulty when bringing an extermal library to R via a package consists in dealing with
One common difficulty when bringing an external library to R via a package consists in dealing with
an external dependency. In the case of 'Corels', the GNU GMP library for multi-precision arithmetic
is an optional extension which, if available, improves and accelerates internal processing.

Expand Down
6 changes: 3 additions & 3 deletions vignettes/rmd/Rcpp-modules.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down Expand Up @@ -93,7 +93,7 @@ vignette: >

Exposing \proglang{C++} functionality to \proglang{R} is greatly facilitated
by the \pkg{Rcpp} package and its underlying \proglang{C++} library
\citep{CRAN:Rcpp,JSS:Rcpp}. \pkg{Rcpp} smoothes many of the rough edges in
\citep{CRAN:Rcpp,JSS:Rcpp}. \pkg{Rcpp} smooths many of the rough edges in
\proglang{R} and \proglang{C++} integration by replacing the traditional
\proglang{R} Application Programming Interface (API) described in
'\textsl{Writing R Extensions}' \citep{R:Extensions} with a consistent set of \proglang{C++}
Expand Down Expand Up @@ -955,7 +955,7 @@ setMethod("show", yada$World , function(object) {
object$greet())
writeLines(msg)
} )
yada$World$new() # implictly calls show
yada$World$new() # implicitly calls show
```

TODO: mention R inheritance (John ?)
Expand Down
8 changes: 4 additions & 4 deletions vignettes/rmd/Rcpp-package.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down Expand Up @@ -161,7 +161,7 @@ $
\end{ShadedResult}

Using \rdoc{Rcpp}{Rcpp.package.skeleton} is by far the simplest approach
as it fulfills two roles. It creates the complete set of files needed for a
as it fulfils two roles. It creates the complete set of files needed for a
package, and it also includes the different components needed for using
\pkg{Rcpp} that we discuss in the following sections.

Expand Down Expand Up @@ -292,7 +292,7 @@ new standard, however, is much easier and is described below.

Unfortunately, the `LinkingTo` declaration in itself was not
enough to link to the user \proglang{C++} library of \pkg{Rcpp}. Until more
explicit support for libraries is added to \proglang{R}, ones needes to manually
explicit support for libraries is added to \proglang{R}, ones needs to manually
add the \pkg{Rcpp} library to the `PKG_LIBS` variable in the
`Makevars` and `Makevars.win` files. (This has now changed with
release 0.11.0; see below).
Expand Down Expand Up @@ -487,5 +487,5 @@ detail, and references to further examples were provided.

[^1]: Setting `attributes` to `TRUE` is the default. This document
does not cover the behavior of `Rcpp.package.skeleton` when `attributes` is set
to `FALSE` as we try to encourage package developpers to use
to `FALSE` as we try to encourage package developers to use
attributes.
4 changes: 2 additions & 2 deletions vignettes/rmd/Rcpp-quickref.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down Expand Up @@ -399,7 +399,7 @@ RNGScope scope;
// In some cases (e.g. rnorm), dist-specific
// arguments can be omitted; when in doubt,
// specify all dist-specific arguments. The use
// of doublesrather than integers for dist-
// of doubles rather than integers for dist-
// specific arguments is recommended. Unless
// explicitly specified, log=FALSE.
Expand Down
10 changes: 5 additions & 5 deletions vignettes/rmd/Rcpp-sugar.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true

# Optional: Enables lineo mode, but only if one_column mode is also true
# Optional: Enables lineno mode, but only if one_column mode is also true
#lineno: true

# Optional: Enable one-sided layout, default is two-sided
Expand Down Expand Up @@ -123,7 +123,7 @@ RcppExport SEXP foo(SEXP x, SEXP y) {
The goal of the function `foo` code is simple. Given two
`numeric` vectors, we create a third one. This is typical low-level
\proglang{C++} code that that could be written much more consicely in
\proglang{C++} code that that could be written much more concisely in
\proglang{R} thanks to vectorisation as shown in the next example.
```{r, eval = FALSE}
Expand Down Expand Up @@ -501,7 +501,7 @@ One point to note is that the programmer using these functions needs to
initialize the state of the random number generator as detailed in Section
6.3 of the `Writing R Extensions' manual \citep{R:Extensions}. A nice
\proglang{C++} solution for this is to use a \textsl{scoped} class that sets
the random number generatator on entry to a block and resets it on exit. We
the random number generator on entry to a block and resets it on exit. We
offer the \code{RNGScope} class which allows code such as

```cpp
Expand Down Expand Up @@ -591,7 +591,7 @@ public:
this)->size();
}
/* definition ommited here */
/* definition omitted here */
class iterator;
inline iterator begin() const {
Expand All @@ -616,7 +616,7 @@ The `VectorBase` template has three parameters:
generated by sugar expressions as these are guaranteed to produce
expressions that are without missing values. An example is the
`is_na` function. This parameter is used in several places as part
of the compile time dispatch to limit the occurence of redundant
of the compile time dispatch to limit the occurrence of redundant
operations.
- `VECTOR`: This parameter is the key of \sugar. This is the
manifestation of CRTP. The indexing operator and the `size` method
Expand Down

0 comments on commit 6193de5

Please sign in to comment.