Search code examples
c#rwindowsnfsr.net

An unhandled exception of type 'RDotNet.EvaluationException' occurred in RDotNet.dll


R.Net is throwing error while using Network File path in a Windows Forms application.

engine.Evaluate("source('\\\\Something.x.y.z.edu/SomeLocation/SomeFile.R');");

While the same statement works if I try to run the line source('\\\\Something.x.y.z.edu/SomeLocation/SomeFile.R'); in R or RStudio.

Any thoughts or suggestions are appreciated. Thank you.


Solution

  • You probably need in C#

    engine.Evaluate("source('\\\\\\\\Something.x.y.z.edu/SomeLocation/SomeFile.R');");
    

    so that the string

    "source('\\\\Something.x.y.z.edu/SomeLocation/SomeFile.R');"
    

    is passed to R.