Now Rcpp used in packages 300 R
This morning Rcpp reached round milestones: 300 packages on CRAN
now depend on it. It is interesting that there were 200 packages at the end of April, and in
early August – 250.
Rcpp package provides classes C ++, which significantly
facilitate the establishment of communication with the code C or C ++ in R packages using an interface
.Call (), is available in R.
Rcpp ensures that C ++ classes for a large
number of basic types of data R. Therefore, the author of the package can keep
their data in the normal data structures R, without worrying about the translation or
transfer them in C ++. At the same time, you can easily access to the structures
Data on C ++ level and used them in the usual manner.
Display data types works in both directions. Can
how to transfer data from the R in C ++, and return data from the C ++ supported in R.
The following data types.
Data type (SEXP) correspond to R
C ++ objects in the class hierarchy. It supports all types of R: vectors, functions,
Wednesday, etc …, and each type is displayed on the selected class. For example, numeric
vectors are represented as Rcpp :: NumericVector, environment (environments) class presented
like cpp :: Environment ,, functions are represented as Rcpp :: Function, etc …
C ++ base library also offers wrappers Rcpp :: wrap features
which is a pattern function that converts an arbitrary object in
SEXP. This allows you to directly implement the logic of C ++ in terms of the standard
types C ++, such as STL containers and then wrap them when they return to R.
Internally, the wrapper uses advanced methods templates
meta-programming, and currently supports the following data types:
primitive types: bool, int, double, size_t, Rbyte, Rcomplex, std :: string,
STL containers, for example, std :: vector.
The inverse conversion (from
R in C ++) is performed by template function Rcpp :: as, offering a similar degree
flexibility.
Since version 0.7.0 Rcpp comprises altered function ‘cfunction’,
R which allows the user to define the body functions as a standard C ++ symbol vector
R, transmitted in ‘cfunction’ along with several other parameters. then the function
creates a complete C ++ source file containing a function with this body. Then
compiles, links, and downloads it. Along with the class interface it allows Rcpp
very easy to use C ++ in R.
Next posts
- Bullish view on currency pair USDCAD remains
- Euro is trading below 55 5 rubles dollar Below
- EURUSD is on two year low