2
2
3
3
### Seamless R and C++ Integration
4
4
5
- The [ Rcpp package] ( https://cran.r-project.org/package=Rcpp ) provides R functions and a C++ library
5
+ The [ Rcpp package] ( https://cran.r-project.org/package=Rcpp ) provides R
6
+ functions and a (header-only for client packages) C++ library greatly
6
7
facilitating the integration of R and C++.
7
8
8
- R data types ( ` SEXP ` ) are matched to C++ objects in a class hierarchy. All R
9
- types are supported (vectors, functions, environment, etc ...) and each
10
- type is mapped to a dedicated class. For example, numeric vectors are
11
- represented as instances of the Rcpp::NumericVector class, environments are
12
- represented as instances of Rcpp::Environment, functions are represented as
13
- Rcpp::Function, etc ...
14
- The
9
+ All underlying R types and objects, _ i.e. _ , everything a ` SEXP ` represents internally
10
+ in R, are matched to corresponding C++ objects. This covers anything from vectors,
11
+ matrices or lists to environments, functions and more. Each ` SEXP ` variant is
12
+ automatically mapped to a dedicated C++ class. For example, numeric vectors are
13
+ represented as instances of the ` Rcpp::NumericVector ` class, environments are
14
+ represented as instances of ` Rcpp::Environment ` , functions are represented as
15
+ ` Rcpp::Function ` , etc ... The
15
16
[ Rcpp-introduction] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-introduction.pdf )
16
- vignette (also published as a [ JSS paper] ( http://www.jstatsoft.org/v40/i08/ ) ) provides a good
17
- entry point to Rcpp as do the [ Rcpp website] ( http://www.rcpp.org ) , the
18
- [ Rcpp page] ( http://dirk.eddelbuettel.com/code/rcpp.html ) and the
19
- [ Rcpp Gallery] ( http://gallery.rcpp.org ) . Full documentation
20
- is provided by the [ Rcpp book] ( http://www.rcpp.org/book/ ) .
21
-
22
- Conversion from C++ to R and back is driven by the templates ` Rcpp::wrap `
17
+ vignette (now published as a
18
+ [ TAS paper] ( https://amstat.tandfonline.com/doi/abs/10.1080/00031305.2017.1375990 ) ; an
19
+ [ earlier introduction] ( https://cloud.r-project.org/web/packages/Rcpp/vignettes/Rcpp-jss-2011.pdf )
20
+ was also published as a [ JSS paper] ( http://www.jstatsoft.org/v40/i08/ ) )
21
+ provides a good entry point to Rcpp as do the [ Rcpp
22
+ website] ( http://www.rcpp.org ) , the [ Rcpp
23
+ page] ( http://dirk.eddelbuettel.com/code/rcpp.html ) and the [ Rcpp
24
+ Gallery] ( http://gallery.rcpp.org ) . Full documentation is provided by the
25
+ [ Rcpp book] ( http://www.rcpp.org/book/ ) .
26
+
27
+ Other highlights:
28
+
29
+ - The conversion from C++ to R and back is driven by the templates ` Rcpp::wrap `
23
30
and ` Rcpp::as ` which are highly flexible and extensible, as documented
24
31
in the [ Rcpp-extending] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-extending.pdf ) vignette.
25
32
26
- Rcpp also provides Rcpp modules, a framework that allows exposing
33
+ - Rcpp also provides Rcpp modules, a framework that allows exposing
27
34
C++ functions and classes to the R level. The [ Rcpp-modules] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-modules.pdf ) vignette
28
35
details the current set of features of Rcpp-modules.
29
36
30
- Rcpp includes a concept called Rcpp sugar that brings many R functions
37
+ - Rcpp includes a concept called Rcpp sugar that brings many R functions
31
38
into C++. Sugar takes advantage of lazy evaluation and expression templates
32
39
to achieve great performance while exposing a syntax that is much nicer
33
40
to use than the equivalent low-level loop code. The [ Rcpp-sugar] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-sugar.pdf )
34
41
gives an overview of the feature.
35
42
36
- Rcpp attributes provide a high-level syntax for declaring C++
43
+ - Rcpp attributes provide a high-level syntax for declaring C++
37
44
functions as callable from R and automatically generating the code
38
45
required to invoke them. Attributes are intended to facilitate both
39
46
interactive use of C++ within R sessions as well as to support R
@@ -43,18 +50,28 @@ See the [Rcpp-atttributes](https://cran.r-project.org/package=Rcpp/vignettes/Rcp
43
50
44
51
### Documentation
45
52
46
- The package ships with nine pdf vignettes.
47
-
48
- Additional documentation is available via the
49
- [ JSS paper] ( http://www.jstatsoft.org/v40/i08/ ) by Eddelbuettel and
50
- Francois (2011, JSS) paper (corresponding to the 'intro' vignette)
51
- and the [ book] ( http://www.rcpp.org/book ) by Eddelbuettel (2013, Springer);
52
- see 'citation("Rcpp")' for details.
53
+ The package ships with nine pdf vignettes, including a [ recent introduction to
54
+ Rcpp] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-introduction.pdf ) now
55
+ published as a [ paper in
56
+ TAS] ( https://amstat.tandfonline.com/doi/abs/10.1080/00031305.2017.1375990 ) (and as a
57
+ [ preprint in PeerJ] ( https://peerj.com/preprints/3188/ ) ). Also available is an
58
+ [ earlier
59
+ introduction] ( https://cloud.r-project.org/web/packages/Rcpp/vignettes/Rcpp-jss-2011.pdf )
60
+ which was published as a [ JSS paper] ( http://www.jstatsoft.org/v40/i08/ ) )
61
+
62
+ Among the other vignettes are the [ Rcpp
63
+ FAQ] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-FAQ.pdf ) and the
64
+ introduction to [ Rcpp
65
+ Attributes] ( https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-attributes.pdf ) .
66
+ Additional documentation is available via the [ Rcpp book] ( http://www.rcpp.org/book )
67
+ by Eddelbuettel (2013, Springer); see 'citation("Rcpp")' for details.
53
68
54
69
### Examples
55
70
56
71
The [ Rcpp Gallery] ( http://gallery.rcpp.org ) showcases over one hundred fully
57
- documented and working examples.
72
+ documented and working examples. The
73
+ [ package RcppExamples] ( https://cran.r-project.org/package=RcppExamples ) contains a few basic
74
+ examples covering the core data types.
58
75
59
76
A number of examples are included as are 1429 unit tests in 618 unit
60
77
test functions provide additional usage examples.
@@ -66,7 +83,7 @@ available for code relying on the older interface. New development should
66
83
always use this Rcpp package instead.
67
84
68
85
Other usage examples are provided by packages using Rcpp. As of July 2018,
69
- there are 1402 [ CRAN] ( https://cran.r-project.org ) packages using Rcpp, a further
86
+ there are 1408 [ CRAN] ( https://cran.r-project.org ) packages using Rcpp, a further
70
87
91 [ BioConductor] ( http://www.bioconductor.org ) packages in its current release
71
88
as well as an unknown number of GitHub, Bitbucket, R-Forge, ... repositories
72
89
using Rcpp. All these packages provide usage examples for Rcpp.
0 commit comments