Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Commented Unassigned: RDotNet ParseException on IIS [49]

$
0
0
```
public static double TestOtherR()
{
engine = REngine.GetInstanceFromID("RDotNet");
if (engine == null)
{
var envPath = Environment.GetEnvironmentVariable("PATH");
var rBinPath = @"C:\Program Files\R\R-3.0.1\bin\i386";
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath);
engine = REngine.CreateInstance("RDotNet");
engine.Initialize();
}
// .NET Framework array to R vector.
NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 });
engine.SetSymbol("group1", group1);
// Direct parsing from R script.
NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric();
//return group2.Last();
GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList();
double p = testResult["p.value"].AsNumeric().First();
return 1.0;
}
```
that's my test code,it runs perfectly on my web server debugger,but on iis, it throws ParseException on the line
```
GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList();
```
the line before is all good.
help me please
Comments: I am having the exact same problem. The code is below. Details: Visual Studio 2010. Create a new WCF Service Library. Add in RDOT.net dlls (v 1.5.4 downloaded today) First pass through app gives this output. Notice that (1) works first time and (2) is only initialized once. I notice the "thread exit message" and called engine initialize again (by setting next statement in debugger). Still the same behavior. Starting R Server Initializing Engine.... 30.02, 29.99, 30.11, 29.97, 30.01, 29.99: Group1: [{0}] 29.89, 29.93, 29.72, 29.98, 30.02, 29.98: Group2: [{0}] P-value = 0.091 The thread '<No Name>' (0x41b8) has exited with code 0 (0x0). Starting R Server Initializing Engine.... A first chance exception of type 'RDotNet.ParseException' occurred in RDotNet.dll The thread '<No Name>' (0x18a4) has exited with code 0 (0x0). The thread '<No Name>' (0x2018) has exited with code 0 (0x0). Initializing Engine.... The thread '<No Name>' (0x1b48) has exited with code 0 (0x0). A first chance exception of type 'RDotNet.ParseException' occurred in RDotNet.dll The thread '<Thread Ended>' (0x4468) has exited with code 0 (0x0). Code executing is: public bool startServer() { Console.WriteLine("Starting R Server"); System.Diagnostics.Debug.WriteLine("Starting R Server"); var oldPath = System.Environment.GetEnvironmentVariable("PATH"); // Windows var rPath = System.Environment.Is64BitProcess ? @"C:\Program Files\R\R-3.0.0\bin\x64" : @"C:\Program Files\R\R-3.0.0\bin\i386"; // rPath = System.Environment.Is64BitProcess ? @"C:\Program Files\R\R-3.0.1\bin\i386" : @"C:\Program Files\R\R-3.0.1\bin\i386"; var newPath = System.String.Format("{0}{1}{2}", rPath, System.IO.Path.PathSeparator, oldPath); System.Environment.SetEnvironmentVariable("PATH", newPath); using (REngine engine = REngine.CreateInstance("RDotNet")) { // From v1.5, REngine requires explicit initialization. // You can set some parameters. if (Status == "stopped") { engine.Initialize(); System.Diagnostics.Debug.WriteLine("Initializing Engine...."); } // .NET Framework array to R vector. NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 }); engine.SetSymbol("group1", group1); // Direct parsing from R script. NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric(); // Test difference of mean and get the P-value. GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList(); double p = testResult["p.value"].AsNumeric().First(); System.Diagnostics.Debug.WriteLine("Group1: [{0}]", string.Join(", ", group1)); System.Diagnostics.Debug.WriteLine("Group2: [{0}]", string.Join(", ", group2)); System.Diagnostics.Debug.WriteLine("P-value = {0:0.000}", p); Status = "running"; return true; } }

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>