Publications by romain francois
int64: 64 bit integer vectors for R
The Google Open Source Programs Office sponsored me to create the new int64 package that has been released to CRAN a few days ago. The package has been mentionned in an article in the open source blog from Google. The package defines classes int64 and uint64 that represent signed and unsigned 64 bit integer vectors. The package also allows conve...
2401 sym 2 img
… And now for solution 17, still using Rcpp
Here comes yet another sequel of the code optimization problem from the R wiki, still using Rcpp, but with a different strategy this time Essentially, my previous version (15) was using stringstream although we don’t really need its functionality and it was slowing us down Also, the characters “i” and “.” are always on the same position...
896 sym R (153 sym/1 pcs)
Crawling facebook with R
So, let’s crawl some data out of facebook using R. Don’t get too excited though, this is just a weekend whatif project. Anyway, so for example, I want to download some photos where I’m tagged. First, we need an access token from facebook. I don’t know how to get this programmatically, so let’s get one manually, log on to facebook and th...
1269 sym R (34 sym/1 pcs) 2 img
Rcpp modules more flexible
Rcpp modules just got more flexible (as of revision 3838 of Rcpp, to become 0.9.16 in the future). modules have allowed exposing C++ classes for some time now, but developpers had to declare custom wrap and as specializations if they wanted their classes to be used as return type or argument type of a C++ function or method. This led to writing...
1248 sym
OOP with Rcpp modules
The purpose of Rcpp modules has always been to make it easy to expose C++ functions and classes to R. Up to now, Rcpp modules did not have a way to declare inheritance between C++ classes. This is now fixed in the development version, and the next version of Rcpp will have a simple mechanism to declare inheritance. Consider this simple example, ...
1331 sym 2 img
Improving the graph gallery
I’m trying to make improvements to the R Graph Gallery, I’m looking for suggestions from users of the website. I’ve started a question on the website’s facebook page. Please take a few seconds to vote to existing improvements possibilities and perhaps offer some of your own ideas. Related To leave a comment for the author, please follo...
721 sym 2 img
Moving
This blog is moving to blog.r-enthusiasts.com. The new one is powered by wordpress and gets a subdomain of r-enthusiasts.com. See you there Related To leave a comment for the author, please follow the link and comment on their blog: Romain Francois, Professional R Enthusiast - Tag - R. R-bloggers.com offers daily e-mail updates about R news ...
576 sym 2 img
Extending wrap with Rcpp11
Context Extending wrap to custom classes has always been a struggle in Rcpp, and led to the split between RcppCommon.h and Rcpp.h, the idea being that you load a “minimal” subset of Rcpp, declare your class, declare that you are going to provide a specialization of wrap, load the rest of Rcpp (the meat), and finally define your specializati...
1956 sym R (1018 sym/4 pcs)
Compile times Rcpp11 vs Rcpp
So I’ve been curious about a different kind of performance comparison between Rcpp11 and Rcpp, i.e. I’ve benchmarked the time it takes to compile the following code (the example you get from RStudio when you do new C++ file) with Rcpp and Rcpp11. #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] int timesTwo(int x) { return x...
1314 sym R (573 sym/3 pcs) 2 img
Using mapply in Rcpp11
mapply is a well known (or perhaps not) function in R. mapply applies a function to extracts from one or more vectors. For example in R: > mapply( function(x,y, z) x + y + z, 1:4, 4:1, 2) # [1] 7 7 7 7 Notice how the last argument is recycled as we would expect in R. I’ve recently updated mapply in Rcpp11 to be as flexible as possible. It ha...
1141 sym R (516 sym/3 pcs)