1 / 13

R with COM the dark side of .NET

Zurich. R with COM the dark side of .NET. john@mango-solutions.com. R with COM the dark side of .NET. Why I am talking about ‘nothing to do with R’ What are the issues with integrating R with other languages? The .NET paradigm Work done at codeplex A simple example done for free

nova
Download Presentation

R with COM the dark side of .NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Zurich R with COMthe dark side of .NET john@mango-solutions.com

  2. R with COMthe dark side of .NET • Why I am talking about ‘nothing to do with R’ • What are the issues with integrating R with other languages? • The .NET paradigm • Work done at codeplex • A simple example done for free • Graphing

  3. nothing to do with R • R solves difficult but particular problems • Enterprises have other issues • Integration with databases • R may be part of much larger developments • There is no concept of workflow

  4. integrating R • R is late binding • Variable ‘types’ change at every step • Manages its own memory • Initial design as a pipe application, stdin, stdout (like sed etc.)

  5. integrating R • The big problem is exchanging complex objects in memory • Strings are never a problem! • Vectors, matrices, lists must be mapped to concepts inj the host language • COM solves by creating is own process with R • Expensive! • Java integration solves by utilizing only static types • Need to know a lot about the data before • .NET introduces “marshalling” • An buffer area where data can be read/written between managed and un-managed code

  6. .NET paradigm • (From Windows) • Event Handling • Common Run Time • Now towards its 4th incarnation • Good support for threading • security • Remoting • Diverse application languages • Adoption (and rejection) of new languages (e.g. J# and F#)

  7. Events • Message passing paradigm including call-backs private void Application_Startup(object sender, StartupEventArgs e) { REngine.SetDllDirectory(@"C:\R\R-2.10.1\bin"); REngine.CreateInstance("RDotNet"); } private void Application_Exit(object sender, ExitEventArgs e) { REngine engine = REngine.GetInstanceFromID("RDotNet"); if (engine != null) { engine.Close(); } }

  8. XAML and ‘code-behind’

  9. rdotnet.codeplex.com • Microsoft Project Hosting for Open Source Software • Implementation of R.h and Rinternals.h • Very impressive C# code • Currently only console device internal interface INativeMethodsProxy { intRf_initEmbeddedR(intargc, string[] argv); void Rf_endEmbeddedR(int fatal); IntPtrRf_protect(IntPtrsexp); void Rf_unprotect(int count); void Rf_unprotect_ptr(IntPtrsexp);

  10. Classes in R.NET bridges between R and .NET Framework.

  11. A simple example done for free

  12. Graphing

  13. Conclusions • .NET provides a modern wrapper for making the best use of R • .NET can be developed for free • A full environment does cost a little • An open license without the R(D)COM constraints • Just as easy to integrate with Excel

More Related