0

I have, in one hand, a plateform I developped in R, composed of many user-defined functions used to produce a report, using as inputs matrices and arguments.

In an other I manage my data flow through a c# Platform.

What I want to do is calling my R Platform from c# : calling a function defined in an Rdata file into my c# code (which handle all my data matrices).

I am familiar with RdotNet and use it to call user defined functions, but these are functions defined in my c# code itself, while I need to call functions in a Rdata file.

Thanks in advance.

1

1 Answer 1

2

R functions called from R.NET are not restricted to ones created from strings in .NET. If you define and save the function definition in R:

f <- function() {"Hello World"}
save(f, file='f.RData')

Then in C# you simply do something like

static void stackoverflow_27924923_2752565 (REngine engine)
{
    engine.Evaluate ("load('~/f.RData')");
    var s = engine.Evaluate ("f()").AsCharacter()[0];
    Console.WriteLine(s);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.