Tuesday, 27 January 2015

rClr 0.7-3 released

Version 0.7-3 of rClr (source code also on GitHub), a package to access arbitrary .NET code seamlessly in-process, has just been released. The package was first introduced a year and a half ago in another blog post, and you can skim through that prior post to get an overview of the capabilities. This post will summarise newer features.

A lot has happened technologically to enable this release. The library R.NET has evolved and been through several rounds of fixes, runtime performance improvements, and refactoring. It is now the prefered subsystem in rClr to handle data conversion, and is active by default.

An overview of the improvements since the release series 0.5.x is:
  • Running unit tests on a Linux/Mono stack is at feature parity with Windows/Microsoft.NET. A few edge cases with date and time at daylight savings transitions are the only known limitation.
  • The conversion of data between R and .NET is increasingly handled via C# code rather than C++. While transparent to an R user, this is important because the same code can run on Mono and MS.NET, where C++ code is trickier and usually will vary between these two runtimes. Further data conversion features will be much, much easier to implement in C#.
  • Complex numbers are supported
  • Matrix conversions
  • It is possible to transparently .NET dictionaries into R named lists
  • Many difficulties with the discovery/loading of the native R shared libraries have been alleviated.


Some developments are reshaping the landscape of the .NET world. Most of the .NET stack is now being genuinely open sourced. Closer to the R community is the recent announcement of Revolution Analytics joining Microsoft. It is likely that a more open sourced .NET stack will greatly facilitate new features for rClr. I have no insight as to Revolution Analytics, but hope rClr has a role to play and will seek collaboration or advice.

Aside from this changing broader context, some things to tackle are:
  • Documentation, documentation, documentation...
  • Facilities to more easily convert data between .NET DataTable and R data frames
  • Supporting Generic .NET classes
  • Wrapping .NET classes and interfaces with R Reference Classes. This feature has been explored and is already quite functional on a branch, with automatic R reference class code generation, but the R code for reference classes can lead to unacceptably long runtimes even with not so complicated complicated inheritance trees.
  • Submission to CRAN?

Related work

A few packages using rClr are publicly accessible, and may be of interest if you want to build your own package with dependencies on rClr.