Porting existing C++ code to R

I would like to port the SpecialK Poker Hand evaluator to R. I think this should be relatively easy using the Rcpp package, but I have no idea where to begin.

The existing tutorials seem to focus on developing new C++ code for use in R. In this case, I have C++ that solves a problem, and I want to use this code in R with minimum hassle. If the code were one, self-contained function, I could compile and link it on the fly with inline, but this doesn't work here.

I guess this question has 2 parts:

  1. Will I need to make any changes to the C++ source to make it compatible with Rcpp?
  2. How do I call this code from R, given that it's not a small, self-contained function I can compile and link dynamically using inline?

I am also open to using the Java, python, or objective-C versions of the evaluator, but I don't think those will be easier to link to R.

Answers


Have you looked at Rcpp which makes it fairly painfree to combine R and C++?

Lots of packages use it to bring existing C++ code to R. You can also look at questions here under the [rcpp] tag. Fairly extensive documentation in the package, at my site and other places.


Need Your Help

How to combine the data from two CSV files in BASH?

ruby perl bash csv python-2.7

I have two CSV files which use @ to divide each column. The first file (file1.csv) has two columns:

Hibernate optimistic locking test

java hibernate testing

I know this has been asked before, but I'm trying to test Hibernate's optimistic locking feature using a version field.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.