diff --git a/ChangeLog b/ChangeLog index d319c2a41..cdf1719ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2023-11-11 Dirk Eddelbuettel + + * vignettes/rmd/Rcpp-FAQ.Rmd: Updated and edited + * vignettes/pdf/Rcpp-FAQ.pdf: Updated + * vignettes/rmd/Rcpp.bib: Updated + +2023-10-28 Dirk Eddelbuettel + + * vignettes/rmd/Rcpp-FAQ.Rmd: Updated and edited + * vignettes/pdf/Rcpp-FAQ.pdf: Updated + * vignettes/rmd/Rcpp.bib: Updated + 2023-10-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version diff --git a/inst/bib/Rcpp.bib b/inst/bib/Rcpp.bib index 33e74d0b2..5e66d669b 100644 --- a/inst/bib/Rcpp.bib +++ b/inst/bib/Rcpp.bib @@ -75,7 +75,7 @@ @Misc{Brokken:2011:Cpp @Manual{CRAN:anytime, title = {anytime: Anything to 'POSIXct' or 'Date' Converter}, author = {Dirk Eddelbuettel}, - year = {2021}, + year = {2020}, note = {R package version 0.3.9}, url = CRAN # "package=anytime" } @@ -154,11 +154,20 @@ @Manual{CRAN:Rcpp:FAQ crossref = {CRAN:Rcpp}, author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, title = {Frequently Asked Questions About {Rcpp}}, - year = 2022, + year = 2023, note = {Vignette included in R package {Rcpp}}, url = CRAN # "package=Rcpp" } +@Manual{CRAN:Rcpp:Libraries, + crossref = {CRAN:Rcpp}, + author = {Dirk Eddelbuettel}, + title = {Thirteen Simple Steps for Creating An R Package with an External C++ Library }, + year = 2023, + note = {Vignette included in R package Rcpp}, + url = CRAN # "package=Rcpp" +} + @Manual{CRAN:Rcpp:Modules, crossref = {CRAN:Rcpp}, author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, @@ -199,8 +208,8 @@ @Manual{CRAN:RcppArmadillo @Manual{CRAN:RcppCCTZ, title = {RcppCCTZ: Rcpp Bindings for the CCTZ Library}, author = {Dirk Eddelbuettel}, - year = 2021, - note = {R package version 0.2.10}, + year = 2022, + note = {R package version 0.2.12}, url = CRAN # "package=RcppCCTZ" } @@ -254,6 +263,14 @@ @Manual{CRAN:RcppGSL url = CRAN # "package=RcppGSL" } +@Manual{CRAN:RcppInt64, + title = {RppInt64: Rcpp-Based Helper Functions to Pass Int64 and nanotime Values Between R and C++}, + author = {Dirk Eddelbuettel}, + year = 2023, + note = {R package version 0.0.3}, + url = CRAN # "package=RcppInt64" +} + @Manual{CRAN:RcppZiggurat, title = {RcppZiggurat: Rcpp Integration of Different Ziggurat Normal RNG Implementations}, author = {Dirk Eddelbuettel}, @@ -310,8 +327,8 @@ @Manual{CRAN:inline @Manual{CRAN:littler, title = {littler: {R} at the {Command-Line} via r}, author = {Dirk Eddelbuettel and Jeffrey Horner}, - year = 2021, - note = {R package version 0.3.15}, + year = 2023, + note = {R package version 0.3.18}, url = CRAN # "package=littler" } @@ -734,7 +751,7 @@ @manual{R:Administration author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2018, + year = 2023, title = "R Installation and Administration", annote = {{ISBN} 3-900051-09-7}, url = manuals # "R-admin.html" @@ -744,7 +761,7 @@ @manual{R:Extensions author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "Writing R extensions", annote = {{ISBN} 3-900051-11-9}, url = manuals # "R-exts.html" @@ -754,7 +771,7 @@ @manual{R:Internals author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "R internals", annote = {{ISBN} 3-900051-14-3}, url = manuals # "R-ints.html" @@ -764,7 +781,7 @@ @manual{R:Language author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "R language", annote = {{ISBN} 3-900051-13-5}, url = manuals # "R-lang.html" @@ -776,7 +793,7 @@ @Manual{R:Main author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, url = {https://www.R-project.org/} } diff --git a/vignettes/pdf/Rcpp-FAQ.pdf b/vignettes/pdf/Rcpp-FAQ.pdf index 6d6cf96ba..e4159dd55 100644 Binary files a/vignettes/pdf/Rcpp-FAQ.pdf and b/vignettes/pdf/Rcpp-FAQ.pdf differ diff --git a/vignettes/rmd/Rcpp-FAQ.Rmd b/vignettes/rmd/Rcpp-FAQ.Rmd index 4052ae255..cc8774d61 100644 --- a/vignettes/rmd/Rcpp-FAQ.Rmd +++ b/vignettes/rmd/Rcpp-FAQ.Rmd @@ -134,33 +134,28 @@ means one needs: Also see the [RStudio documentation](http://www.rstudio.com/ide/docs/packages/prerequisites) on pre-requisites for R package development. -## What compiler can I use +## What compiler can I use {#q:what-compiler} -On almost all platforms, the GNU Compiler Collection (or `gcc`, which -is also the name of its \proglang{C} language compiler) has to be used along -with the corresponding `g++` compiler for the \proglang{C++} language. -A minimal suitable version is a final 4.2.* release; earlier 4.2.* were -lacking some \proglang{C++} features (and even 4.2.1, still used on OS X as the -last gcc release), has issues). - -Generally speaking, the default compilers on all the common platforms are suitable. +On almost all platforms, the GNU Compiler Collection (or `gcc`, which is also +the name of its \proglang{C} language compiler) can be used along with the +corresponding `g++` compiler for the \proglang{C++} language. Depending on +which C++ compilation standard one wishes to use, a suitably recent variant +of the compiler may be needed. But these days the minimum standard of C++11 +is generally available, and the default compilers on all the common platforms +are now suitable. Specific per-platform notes: \begin{description} \item[Windows] users need the \texttt{Rtools} package from the site maintained by - Duncan Murdoch which contains all the required tools in a single package; - complete instructions specific to Windows are in the `R Administration' - manual \citep[Appendix D]{R:Administration}. As of August 2014, it still - installs the \texttt{gcc/g++} 4.6.* compiler which limits the ability to use - modern C++ standards so only \code{s-std=c++0x} is supported. R 3.1.0 and - above detect this and set appropriate flags. - \item[OS X] users, as noted in the `R Administration' manual \citep[Appendix + Tomas Kalibera which contains all the required tools in a single package; + complete instructions specific to Windows are in the "R Administration" + manual \citep[Appendix D]{R:Administration}. + \item[macOS] users, as noted in the "R Administration" manual \citep[Appendix C.4]{R:Administration}, need to install the Apple Developer Tools - (\textsl{e.g.}, \href{https://itunes.apple.com/us/app/xcode/id497799835?mt=12}{Xcode} (OS X $\le 10.8$) or \href{https://developer.apple.com/library/ios/technotes/tn2339/_index.html}{Xcode Command Line Tools} (OS X $\ge 10.9$) (as well as \texttt{gfortran} if \proglang{R} or + (\textsl{e.g.}, \href{https://developer.apple.com/library/ios/technotes/tn2339/_index.html}{Xcode Command Line Tools} (as well as \texttt{gfortran} if \proglang{R} or Fortran-using packages are to be built); also see \faq{q:OSX} and - \faq{q:OSXArma} below. Depending on whether on OS X release before or after - Mavericks is used, different additional installation may be needed. Consult + \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 distributions provide helper packages which pull in all the required @@ -169,30 +164,28 @@ Specific per-platform notes: The `clang` and `clang++` compilers from the LLVM project can also be used. On Linux, they are inter-operable with `gcc` et al. On -OS X, they are unfortunately not ABI compatible. The `clang++` -compiler is interesting as it emits much more comprehensible error messages -than `g++` (though `g++` 4.8 and 4.9 have caught up). +macOS, they are unfortunately not ABI compatible. -The Intel `icc` family has also been used successfully as its output -files can also be combined with those from `gcc`. +In general, any compiler supported by R itself can be used. ## What other packages are useful -Additional packages that we have found useful are: +Additional packages that we have found useful are \pkg{inline} if one wants +to create compiled functions _without_ the help of \pkg{Rcpp} as well as the different benchmarking +and unit testing packages. A short list follows, it is not meant to be +exhaustive as CRAN by now has \textsl{many} helpful packages: \begin{description} \item[\pkg{inline}] which is invaluable for direct compilation, linking and loading of short code snippets---but now effectively superseded by the Rcpp Attributes (see \faq{using-attributes} and \faq{prototype-using-attributes}) feature provided by \pkg{Rcpp}; -\item[\pkg{RUnit}] is used for unit testing; the package is recommended and - will be needed to re-run some of our tests but it is not strictly required - during use of \pkg{Rcpp}; -\item[\pkg{rbenchmark}] to run simple timing comparisons and benchmarks; it is also - recommended but not required. -\item[\pkg{microbenchmark}] is an alternative for benchmarking. -\item[\pkg{devtools}] can help the process of building, compiling and testing - a package but it too is entirely optional. + \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 + 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 + comparisons and benchmarks; they are also recommended but not required. \end{description} ## What licenses can I choose for my code @@ -257,13 +250,10 @@ Template Library to sum the elements of a numeric vector. ```{r} fx <- cxxfunction(signature(x = "numeric"), - 'NumericVector xx(x); - return wrap( - std::accumulate(xx.begin(), - xx.end(), - 0.0) - );', - plugin = "Rcpp") + 'NumericVector xx(x); + return wrap(std::accumulate(xx.begin(), + xx.end(), 0.0));', + plugin = "Rcpp") res <- fx(seq(1, 10, by=0.5)) res ``` @@ -298,9 +288,7 @@ The example above can now be rewritten as: ```{r} cppFunction('double accu(NumericVector x) { - return( - std::accumulate(x.begin(), x.end(), 0.0) - ); + return(std::accumulate(x.begin(), x.end(), 0.0)); }') res <- accu(seq(1, 10, by=0.5)) res @@ -344,11 +332,11 @@ the \proglang{R} expression following the `-e` switch. Such an expression can contain multiple statements separated by semicolons. \rdoc{utils}{Rscript} is available on all three core operating systems. -On Linux, one can also use `r` from the `littler` package by Horner -and Eddelbuettel which is an alternative front end to \proglang{R} designed -for both `#!` (hashbang) scripting and command-line use. It has slightly -faster start-up times than \rdoc{utils}{Rscript}; and both give a guaranteed clean -slate as a new session is created. +On Linux, one can also use `r` from the `littler` package +\citep{CRAN:littler} which is an alternative front end to \proglang{R} +designed for both `#!` (hashbang) scripting and command-line use. It has +slightly faster start-up times than \rdoc{utils}{Rscript}; and both give a +guaranteed clean slate as a new session is created. The example then becomes @@ -360,8 +348,8 @@ $ R CMD INSTALL mypkg && \ The `-l` option calls 'suppressMessages(library(mypkg))' before executing the \proglang{R} expression. Several packages can be listed, separated by a comma. -More choice are provide by the \pkg{devtools} package, and by using -RStudio. See the respective documentation for details. +More choices are provided by other packages and IDEs. See their respective +documentation for details. ## But I want to compile my code with R CMD SHLIB {#using-r-cmd-shlib} @@ -378,8 +366,6 @@ against. On the Linux command-line, you can do the following: ```{bash, eval = FALSE} -$ # if Rcpp older than 0.11.0 -$ export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"` $ export PKG_CXXFLAGS=\ `Rscript -e "Rcpp:::CxxFlags()"` $ R CMD SHLIB myfile.cpp @@ -395,13 +381,11 @@ Dirk's older 'Intro to HPC with R' tutorial slides). It is still not recommended as there are tools and automation mechanisms that can do the work for you. -\pkg{Rcpp} versions 0.11.0 or later can do with the definition of -`PKG_LIBS` as a user-facing library is no longer needed (and hence no -longer shipped with the package). One still needs to set `PKG_CXXFLAGS` -to tell R where the \pkg{Rcpp} headers files are located. +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 -extension `.so` on Linux, `.dylib` on OS X or `.dll` on +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 \emph{strongly} recommend using a package, or at least Rcpp Attributes as @@ -432,15 +416,12 @@ of packages using \pkg{Rcpp}. But this only helps in having \proglang{R} compute the location of the header files for us. The actual library location and argument still needs to be provided by the -user. How to do so has been shown above, and we recommned you use either -\faq{make-package} or \faq{using-inline} both which use the \pkg{Rcpp} -function `Rcpp:::LdFlags()`. - -If and when `LinkingTo` changes and lives up to its name, we will be -sure to adapt \pkg{Rcpp} as well. +user. This topic can get complicated real quickly, and there is an entire +vignette devoted to it, so see \citet{CRAN:Rcpp:Libraries}. -An important change arrive with \pkg{Rcpp} release 0.11.0 and concern the -automatic registration of functions; see Section~\ref{function-registration} below. +Also note that an important change arrived with \pkg{Rcpp} release 0.11.0 and +concerns the automatic registration of functions; see +Section \ref{function-registration} below. ## Does \pkg{Rcpp} work on windows @@ -457,6 +438,11 @@ Studio simply do not get along. As \pkg{Rcpp} is all about extending toolchain. And \proglang{R} simply does not compile with Visual Studio. Go complain to its vendor if you are still upset. +(These days the 'Code' editor derived from it is popular and can of course be +used with \proglang{R} and \pkg{Rcpp}; see its documentation for the required +plugins. Such use still falls back to the default compilers \proglang{R} is +used with on the given system so see \faq{q:what-compiler} above.) + ## I am having problems building Rcpp on macOS, any help {#q:OSX} There are three known issues regarding Rcpp build problems on macOS. If you are @@ -476,7 +462,7 @@ manual. ### Differing macOS R Versions Leading to Binary Failures -There are currently _three_ distinct versions of R for macOS. +There are _three_ (or more) distinct versions of R for macOS. The first version is a legacy version meant for macOS 10.6 (Snow Leopard) - 10.8 (Mountain Lion). The second version is for more recent system macOS 10.9 (Mavericks) and 10.10 (Yosemite). Finally, the third and most @@ -491,13 +477,13 @@ able to mix. In such cases, it is better to provide collaborators with the ### OpenMP Support By default, the macOS operating environment lacks the ability to parallelize -sections of code using the \proglang{[OpenMP](http://openmp.org/wp/)} -standard. Within \proglang{R} 3.4.*, the default developer environment was -_changed_ to allow for \proglang{OpenMP} to be used on macOS by using -a non-default toolchain provided by R Core Team maintainers for macOS. -Having said this, it is still important to protect any reference to -\proglang{OpenMP} as some users may not yet have the ability to -use \proglang{OpenMP}. +sections of code using the [\proglang{OpenMP} +standard](http://openmp.org/wp/). Within \proglang{R} 3.4.*, the default +developer environment was _changed_ to allow for \proglang{OpenMP} to be used +on macOS by using a non-default toolchain provided by R Core Team maintainers +for macOS. Having said this, it is still important to protect any reference +to \proglang{OpenMP} as some users may not yet have the ability to use +\proglang{OpenMP}. To setup the appropriate protection for using \proglang{OpenMP}, the process is two-fold. First, protect the inclusion of headers with: @@ -528,8 +514,8 @@ Below are additional resources that provide information regarding compiling Rcpp 1. A helpful post was provided by Brian Ripley regarding the use of compiling R code with macOS in April 2014 [on the `r-sig-mac` list](https://stat.ethz.ch/pipermail/r-sig-mac/2014-April/010835.html), - which is generally recommended for OS X-specific questions and further consultation. -2. Another helpful write-up for installation / compilation on OS X Mavericks is provided + which is generally recommended for macOS-specific questions and further consultation. +2. Another helpful write-up for installation / compilation on macOS Mavericks is provided [by the BioConductor project](http://www.bioconductor.org/developers/how-to/mavericks-howto/). 3. Lastly, another resource that exists for installation / compilation help is provided at @@ -552,12 +538,14 @@ is. ## Does \pkg{Rcpp} work on solaris/suncc Yes, it generally does. But as we do not have access to such systems, some -issues persist on the CRAN test systems. +issues persist on the CRAN test systems. And now that more time has passed +since the question was written, CRAN no longer tests on these platforms. -## Does \pkg{Rcpp} work with Revolution R +## Does \pkg{Rcpp} work with REvolution R We have not tested it yet. \pkg{Rcpp} might need a few tweaks to work with the compilers used by Revolution R (if those differ from the defaults). +By now REvolution R is defunct too. ## Is it related to Rho (formerly CXXR) @@ -568,6 +556,7 @@ unrelated. Rho / CXXR and \pkg{Rcpp} both want \proglang{R} to make more use of \proglang{C++} but they do it in very different ways. +By now, Rho is long defunct too. ## How do I quickly prototype my code using Attributes {#prototype-using-attributes} @@ -578,7 +567,7 @@ which is described in detail in its own vignette \rdoc{Rcpp}{cxxfunction} function. -## What about the new 'no-linking' feature {#function-registration} +## What about the 'no-linking' feature {#function-registration} Starting with \pkg{Rcpp} 0.11.0, functionality provided by \pkg{Rcpp} and used by packages built with \pkg{Rcpp} accessed via the registration facility @@ -636,7 +625,7 @@ Several dozen fully documented examples are provided at the > script and then initialize an instance of the class and call a method on > the class, all inline in R. -This question was initially about using templates with \pkg{inline}, and we +\noindent This question was initially about using templates with \pkg{inline}, and we show that (older) answer first. It is also easy with Rcpp Attributes which is what we show below. @@ -744,11 +733,10 @@ arma::colvec z = Rcpp::as(z_) ; // calculate the result double result = arma::as_scalar( - arma::trans(x) * arma::inv(Y) * z - ); + arma::trans(x) * arma::inv(Y) * z); // return it to R -return Rcpp::wrap( result );' +return Rcpp::wrap(result);' writeLines(a, file = "myfile.cpp") ``` @@ -937,7 +925,7 @@ call---and will also run the small R example at the end. > How can I create my own plugin for use by the \pkg{inline} package? -Here is an example which shows how to it using GSL libraries as an +\noindent Here is an example which shows how to it using GSL libraries as an example. This is merely for demonstration, it is also not perfectly general as we do not detect locations first---but it serves as an example: @@ -975,18 +963,18 @@ The same plugins can be used by Rcpp Attributes as well. > How can I pass another flag to the `g++` compiler without writing a new plugin? -The quickest way is to modify the return value from an existing plugin. Here -we use the default one from \pkg{Rcpp} itself in order to pass the new flag -`-std=c++0x`. As it does not set the `PKG_CXXFLAGS` variable, we +\noindent The quickest way is to modify the return value from an existing plugin. Here +we use the default one from \pkg{Rcpp} itself in order to pass the flag +`-std=c++11`. As it does not set the `PKG_CXXFLAGS` variable, we simply assign this. For other plugins, one may need to append to the existing -values instead. +values instead. An older example follow (but note that C++11 or newer is the +default now with more recent R releases) ```{r, eval=FALSE} myplugin <- getPlugin("Rcpp") myplugin$env$PKG_CXXFLAGS <- "-std=c++11" f <- cxxfunction(signature(), settings = myplugin, body = ' - // fails without -std=c++0x std::vector x = { 1.0, 2.0, 3.0 }; return Rcpp::wrap(x); ') @@ -994,13 +982,15 @@ f() ``` For Rcpp Attributes, the attributes `Rcpp::plugin()` can be -used. Currently supported plugins are for C++11 as well as for OpenMP. +used. Currently supported plugins are for C++11 (which is now a standard for +compilation with R, but used to be an opt-in), other compilation standards +C++14, C++17, C++20, C++23, as well as for OpenMP. ## How can I set matrix row and column names > Ok, I can create a matrix, but how do I set its row and columns names? -Pretty much the same way as in \proglang{R} itself: We define a list with two +\noindent Pretty much the same way as in \proglang{R} itself: We define a list with two character vectors, one each for row and column names, and assign this to the `dimnames` attribute: @@ -1043,7 +1033,7 @@ Rcpp::List fun(void) { ## Why can long long types not be cast correctly -That is a good and open question. We rely on the basic \proglang{R} types, +\noindent That is a good and open question. We rely on the basic \proglang{R} types, notably `integer` and `numeric`. These can be cast to and from \proglang{C++} types without problems. But there are corner cases. The following example, contributed by a user, shows that we cannot reliably cast @@ -1078,11 +1068,16 @@ fit into `integer` types, up to 53 bit precision fits into for example from the [GNU Multiple Precision Arithmetic Library](http://gmplib.org/) may be an alternative. +However, with care, and via the package \pkg{bit64}, \proglang{R} can use +`integer64` as a type (but storing the 64 bits in a `double`), and +\pkg{RcppInt64} \citep{CRAN:RcppInt64} can help with conversion back and +forth. + ## What LaTeX packages do I need to typeset the vignettes > I would like to typeset the vignettes. What do I need? -The [TeXLive](https://www.tug.org/texlive/) distribution seems to get +\noindent The [TeXLive](https://www.tug.org/texlive/) distribution seems to get bigger and bigger. What you need to install may depend on your operating system. @@ -1090,7 +1085,7 @@ Specific per-platform notes: - **Windows** users probably want the [MiKTeX](http://miktex.org/). Suggestions for a more detailed walk through would be appreciated. -- **OS X** users seem to fall into camps which like or do not like brew / +- **macOS** users seem to fall into camps which like or do not like brew / homebrew. One suggestion was to install [MacTeX](https://tug.org/mactex/mactex-download.html) but at approximately 2.5gb (as of January 2016) this is not lightweight. @@ -1107,7 +1102,7 @@ Specific per-platform notes: > Ok, I would like to pass $N$ object but you only allow 20. How come? -In essence, and in order to be able to compile it with the largest number of +\noindent In essence, and in order to be able to compile it with the largest number of compilers, \pkg{Rcpp} is constrained by the older C++ standards which do not support variadic function arguments. So we actually use macros and code generator scripts to explicitly enumerate arguments, and that number has to stop @@ -1121,7 +1116,7 @@ nest lists. ## Can I use default function parameters with \pkg{Rcpp} -Yes, you can use default parameters with _some_ limitations. +\noindent Yes, you can use default parameters with _some_ limitations. The limitations are mainly related to string literals and empty vectors. This is what is currently supported: @@ -1183,16 +1178,17 @@ support from `src/Makevars`: the language standard which is useful for `sourceCpp()` etc. For packages, R has supported it since R 3.1.0 which added the option to select the language standard via `CXX_STD = CXX11`. As of early 2017, over 120 - packages on CRAN use this. + packages on CRAN use this. As of R 4.0.0, this is the minimum standard and + no longer needed. - _C++14_: has been supported since early 2016 via a plugin selecting the language standard which is useful for `sourceCpp()` etc. For packages, R supports it since R 3.4.0 adding the option to select the language - standard via `CXX_STD = CXX14`. -- _C++17_: is itself more experimental now, but if you have a compiler - supporting (at least parts of) it, you can use it via plugin (starting with - Rcpp 0.12.10) for use via `sourceCpp()`, or via `PKG_CXXFLAGS` or - other means to set compiler options. R support may be available at a later - date. + standard via `CXX_STD = CXX14`. It became the default with R 4.1.0. +- _C++17_: it has been supported (with an appropriate compiler) via plugin starting with + Rcpp 0.12.10, or use via `sourceCpp()`, or via `PKG_CXXFLAGS` or + other means to set compiler options. It became the default with R 4.3.0, + but compiler support may not be widespread. +- _C++20_: It is also supported (given a suitable compiler) since Rcpp 1.0.11. ## How do I use it within (Python's) Conda setup? @@ -1224,6 +1220,10 @@ Beyond modules, RTTI support can also be turned off. this implies turning Modules support off as well so. To select this approach, use the `RCPP_NO_RTTI` define. +Starting with version 1.0.8 of \pkg{Rcpp}, new headers \code{Rcpp/Light}, +\code{Rcpp/Lighter}, \code{Rcpp/Lightest} make this much easier as they +exclude these different (layered) bits of functionality. + # Support ## Is the API documented @@ -1585,7 +1585,7 @@ under the specification for \proglang{C++11} or later version. 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 is engaged by adding +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 which checks to see if `R_xlen_t` is available on your platform: @@ -1817,5 +1817,5 @@ rewritten them once, and do not plan to rewrite them in the near future. Those looking to _parse and convert_ many dates at once could look at \pkg{anytime} \citep{CRAN:anytime} where we use the Boost parser, or similar approaches using the C++ headers-only libraries in packages \pkg{RcppCCTZ} \citep{CRAN:RcppCCTZ} -\pkg{RcppDate} \citep{CRAN:RcppDate}. We are not likely to carry this over to +and \pkg{RcppDate} \citep{CRAN:RcppDate}. We are not likely to carry this over to the \pkg{Rcpp} package as there are advantages in remaining dependency-free. diff --git a/vignettes/rmd/Rcpp.bib b/vignettes/rmd/Rcpp.bib index 33e74d0b2..5e66d669b 100644 --- a/vignettes/rmd/Rcpp.bib +++ b/vignettes/rmd/Rcpp.bib @@ -75,7 +75,7 @@ @Misc{Brokken:2011:Cpp @Manual{CRAN:anytime, title = {anytime: Anything to 'POSIXct' or 'Date' Converter}, author = {Dirk Eddelbuettel}, - year = {2021}, + year = {2020}, note = {R package version 0.3.9}, url = CRAN # "package=anytime" } @@ -154,11 +154,20 @@ @Manual{CRAN:Rcpp:FAQ crossref = {CRAN:Rcpp}, author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, title = {Frequently Asked Questions About {Rcpp}}, - year = 2022, + year = 2023, note = {Vignette included in R package {Rcpp}}, url = CRAN # "package=Rcpp" } +@Manual{CRAN:Rcpp:Libraries, + crossref = {CRAN:Rcpp}, + author = {Dirk Eddelbuettel}, + title = {Thirteen Simple Steps for Creating An R Package with an External C++ Library }, + year = 2023, + note = {Vignette included in R package Rcpp}, + url = CRAN # "package=Rcpp" +} + @Manual{CRAN:Rcpp:Modules, crossref = {CRAN:Rcpp}, author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, @@ -199,8 +208,8 @@ @Manual{CRAN:RcppArmadillo @Manual{CRAN:RcppCCTZ, title = {RcppCCTZ: Rcpp Bindings for the CCTZ Library}, author = {Dirk Eddelbuettel}, - year = 2021, - note = {R package version 0.2.10}, + year = 2022, + note = {R package version 0.2.12}, url = CRAN # "package=RcppCCTZ" } @@ -254,6 +263,14 @@ @Manual{CRAN:RcppGSL url = CRAN # "package=RcppGSL" } +@Manual{CRAN:RcppInt64, + title = {RppInt64: Rcpp-Based Helper Functions to Pass Int64 and nanotime Values Between R and C++}, + author = {Dirk Eddelbuettel}, + year = 2023, + note = {R package version 0.0.3}, + url = CRAN # "package=RcppInt64" +} + @Manual{CRAN:RcppZiggurat, title = {RcppZiggurat: Rcpp Integration of Different Ziggurat Normal RNG Implementations}, author = {Dirk Eddelbuettel}, @@ -310,8 +327,8 @@ @Manual{CRAN:inline @Manual{CRAN:littler, title = {littler: {R} at the {Command-Line} via r}, author = {Dirk Eddelbuettel and Jeffrey Horner}, - year = 2021, - note = {R package version 0.3.15}, + year = 2023, + note = {R package version 0.3.18}, url = CRAN # "package=littler" } @@ -734,7 +751,7 @@ @manual{R:Administration author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2018, + year = 2023, title = "R Installation and Administration", annote = {{ISBN} 3-900051-09-7}, url = manuals # "R-admin.html" @@ -744,7 +761,7 @@ @manual{R:Extensions author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "Writing R extensions", annote = {{ISBN} 3-900051-11-9}, url = manuals # "R-exts.html" @@ -754,7 +771,7 @@ @manual{R:Internals author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "R internals", annote = {{ISBN} 3-900051-14-3}, url = manuals # "R-ints.html" @@ -764,7 +781,7 @@ @manual{R:Language author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, title = "R language", annote = {{ISBN} 3-900051-13-5}, url = manuals # "R-lang.html" @@ -776,7 +793,7 @@ @Manual{R:Main author = RCoreTeam, organization = RFoundation, address = {Vienna, Austria}, - year = 2021, + year = 2023, url = {https://www.R-project.org/} }