rope
is a lightweight string-handling API for R programmers writing C++ backends. It lets you manipulate strings
easily without having to write everything out yourself, but also without having to add the very bulky dependency of
the Boost header libraries. The intended audiences are:
For more information, see the introductory vignette.
Author: Oliver Keyes License: MIT Status: In development
rope
is currently still in development, but if you want to install it and play around with it:
devtools::install_github("ironholds/rope", ref = "0.1.0")
Including it in your R/C++ package is easy!
strapi
to the LinkingTo
parameter in the description file;//[[Rcpp::depends(rope)]]
to the includes section;#include <rope/rope.h>
to the includes section.An example of an R package that uses rope
is urltools; see
parsing.h for an example of how rope
is included.
R has a variety of string handling functions and addon packages, including the excellent stringi and stringr. This is tremendously useful for R programmers, but neither resource is really accessible for people writing R packages with C++ components that need to do string manipulation. You can't pass R-side code back into Rcpp without incurring a big performance hit.
Instead, you either rely on the C++ standard library or the Boost strings library, and you can do pretty much anything with one of the two. The problem is that the standard library is very very low-level (deliberately so!) and the Boost libraries, made accessible through the excellent BH package, are very large.
rope
aims to be a very small, string-dedicated API so that programmers can write C++ to optimise R operations without having
to worry about asking their users to install huge dependencies, or rolling their own versions of particular functions.
Regular expressions weren't introduced to C++ until C++11, which R programmers now have access to as of version 3.2.0 or so. The problem is that most R programmers are still running R2 or R3.0.0, according to CRAN download logs. Including regular expressions would mean switching over to C++11, which would mean making the package inaccessible to people on those versions, which would mean that packages built on strapi wouldn't be usable by most R programmers. Regular expressions will be included when the majority of R users - or a big enough chunk of them - have upgraded to a version that supports C++11 by default.
rope
?Romain suggested it, because, and I quote, "rope is better than string". Blame him!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.