I have almost exact problem except my web application did not return any error but was loading forever. I tried to add both the R paths to system path, but that did not work for me either !!? I am using R version: R-3.1.2, R.NET version: 1.5.16. Any help or hint is greatly appreciated!!
↧
New Post: Error in deployed asp.net application
↧
Commented Unassigned: Parameters in graphics do not apply [151]
Hi all,
When I try to plot an image with parameters such as main="..." or xlab="..." none of the set values show up in the image later on. The call is nested and looks in the end like: Engine.Evaluate("plot(hist(dataGroup, main=\"Title\" xlab=\"x-axis title\" ))"); I'm using a device in order to write an image of the chart to disk.
Maybe an error, or only something wrong in my call?
Best regards,
P_u_S
Comments: Hello skyguy94, Thank you for your reply. The typo was in my post. The code which is used has commas, what makes it more confusing to me. I'm using a device in order to write the created image directly to the disk. Later on I'll put some code here. Thank you for your help. Best regards, P_u_S
When I try to plot an image with parameters such as main="..." or xlab="..." none of the set values show up in the image later on. The call is nested and looks in the end like: Engine.Evaluate("plot(hist(dataGroup, main=\"Title\" xlab=\"x-axis title\" ))"); I'm using a device in order to write an image of the chart to disk.
Maybe an error, or only something wrong in my call?
Best regards,
P_u_S
Comments: Hello skyguy94, Thank you for your reply. The typo was in my post. The code which is used has commas, what makes it more confusing to me. I'm using a device in order to write the created image directly to the disk. Later on I'll put some code here. Thank you for your help. Best regards, P_u_S
↧
↧
Commented Unassigned: Parameters in graphics do not apply [151]
Hi all,
When I try to plot an image with parameters such as main="..." or xlab="..." none of the set values show up in the image later on. The call is nested and looks in the end like: Engine.Evaluate("plot(hist(dataGroup, main=\"Title\" xlab=\"x-axis title\" ))"); I'm using a device in order to write an image of the chart to disk.
Maybe an error, or only something wrong in my call?
Best regards,
P_u_S
Comments: I didn't mention this earlier, but I think your problem is in your R code. If you look at the output of my svg device, you'll see two plots. That's because your plot() call is plotting the output of the hist() plot call. If you are serializing these plots to disk, then its likely that the hist() plot is written over by the plot() call. I think you just need: hist(dataGroup, main="Title", xlab="x-axis title") I feel that none of this is R.Net related, but I'm happy to help you resolve it. Blue Skies, Ritch
When I try to plot an image with parameters such as main="..." or xlab="..." none of the set values show up in the image later on. The call is nested and looks in the end like: Engine.Evaluate("plot(hist(dataGroup, main=\"Title\" xlab=\"x-axis title\" ))"); I'm using a device in order to write an image of the chart to disk.
Maybe an error, or only something wrong in my call?
Best regards,
P_u_S
Comments: I didn't mention this earlier, but I think your problem is in your R code. If you look at the output of my svg device, you'll see two plots. That's because your plot() call is plotting the output of the hist() plot call. If you are serializing these plots to disk, then its likely that the hist() plot is written over by the plot() call. I think you just need: hist(dataGroup, main="Title", xlab="x-axis title") I feel that none of this is R.Net related, but I'm happy to help you resolve it. Blue Skies, Ritch
↧
Updated Wiki: Home
Project Description: R.NET enables the .NET Framework to interoperate with the R statistical language in the same process. R.NET requires .NET Framework 4 and the native R DLLs installed with the R environment. R.NET works on Windows, Linux and MacOS. Enjoy statistics and programming in your special language with R.
You should head for the documentation to get started with R.NET.
2014-11-16 R.NET source code reference repository is now hosted on GitHub. This has been requested by several contributors amongst other things to facilitate pull requests.
2014-06-17 Thanks to Evelina Gabasova for documenting Setting up R.NET on Mac
2014-05-23 Version 1.5.13 is available on nuget.org. Note that the package identifier is R.NET.Community
2014-05-09 Version 1.5.12. A release with a small but important fix, for stability when using non-concurrent execution from several threads.
2014-04-24 Version 1.5.11.
2014-04-20 Version 1.5.10 is released on this site. This is a major upgrade from 1.5.5 (despite the numbering), with many new features, improvements and fixes. While it is tagged beta, it is backed by unit testing and you are encouraged to use it now and give feedback. There are a couple of API changes that will break the compilation of previous code R.NET: this is however a matter of minutes to fix it. This API change is necessary to increase the robustness of R.NET, given some limitations of the native R engine.
R.NET 1.5.5 and related packages remain available:
Program.cs
You should head for the documentation to get started with R.NET.
News
2014-12-16 the R package rClr has been released. R.NET is now enabled by default as the preferred mechanism of rClr for transforming data between R and .NET.2014-11-16 R.NET source code reference repository is now hosted on GitHub. This has been requested by several contributors amongst other things to facilitate pull requests.
2014-06-17 Thanks to Evelina Gabasova for documenting Setting up R.NET on Mac
2014-05-23 Version 1.5.13 is available on nuget.org. Note that the package identifier is R.NET.Community
2014-05-09 Version 1.5.12. A release with a small but important fix, for stability when using non-concurrent execution from several threads.
2014-04-24 Version 1.5.11.
2014-04-20 Version 1.5.10 is released on this site. This is a major upgrade from 1.5.5 (despite the numbering), with many new features, improvements and fixes. While it is tagged beta, it is backed by unit testing and you are encouraged to use it now and give feedback. There are a couple of API changes that will break the compilation of previous code R.NET: this is however a matter of minutes to fix it. This API change is necessary to increase the robustness of R.NET, given some limitations of the native R engine.
NuGet Packages
You will find NuGet packages for R.NET 1.5.11 and R.NET.FSharp 0.1.4 at this download page on this site. They are not uploaded at the public NuGet gallery. You can still use these packages if you set up a local feed. Further instructions are in the documentation.R.NET 1.5.5 and related packages remain available:
- R.NET released on NuGet Gallery (only Windows version). Just type "Install-Package R.NET" to install it.
- F# specific package, RDotNet.FSharp
- an alpha-release graphics engine package, RDotNet.Graphics.
Known Issues
- There are persisting issues running R.NET from an ASP.NET application. The exact cause remains unclear, but this may be a inherent limitation of the R native engine with respect to thread safety.
- Custom startup parameters when initializing the engine are ignored on Windows. The main drawback is memory limitations to 2GB. There will be at least a partial workaround for the next version.
Whetting the appetite
- The example below gives a flavour of how R.NET works from C#. You should head for the documentation to really get started with R.NET. Examples of programming styles mixing C# and R are also available at the Examples page.
Program.cs
using System; using System.Linq; using RDotNet; namespace Sample1 { class Program { staticvoid Main(string[] args) { REngine.SetEnvironmentVariables(); // There are several options to initialize the engine, but by default the following suffice: REngine engine = REngine.GetInstance(); // .NET Framework array to R vector. NumericVector group1 = engine.CreateNumericVector(newdouble[] { 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(); Console.WriteLine("Group1: [{0}]", string.Join(", ", group1)); Console.WriteLine("Group2: [{0}]", string.Join(", ", group2)); Console.WriteLine("P-value = {0:0.000}", p); // you should always dispose of the REngine properly.// After disposing of the engine, you cannot reinitialize nor reuse it engine.Dispose(); } } }
Related Projects
- R to CLR: an R package to access .NET (CLR) objects from R, complementing R.NET. If you are looking to access .NET code from R interactively, you should consider this package.
- F# R Provider: an F# library that provides static typed functions exposed by R packages, using the type provider mechanism of F#.
↧
New Post: R.NET can not get instance at server
To test if it is a general problem with R.NET working with IIS7 under windows server 2008 R2. I created a default web form application by visual studio, just add these three lines to Application_Start in Global.asax file:
I have added the R path to system path but it makes no differences. Anyone have any ideas? It will save my day!!!
REngine.SetEnvironmentVariables();
engine = REngine.GetInstance(); // this is the line where my web application got stuck
engine.Initialize();
The problem remains the same: the application runs successfully under visual studio build, but will fail under IIS. I debugged the IIS process and found out the line is stucking on RDotNet.REngine, method Initialize, then goes to RDotNet.NativeLibrary.UnmanagedDll, GetFunction<setup_Rmainloop>()();. There is no error returned, the web page is simply loading forever.I have added the R path to system path but it makes no differences. Anyone have any ideas? It will save my day!!!
↧
↧
New Post: R.NET can not get instance at server
I'll try to take a look at it on Thurs or Fri to see if I can replicate the issue.
↧
New Post: R.NET can not get instance at server
skyguy94 wrote:
I'll try to take a look at it on Thurs or Fri to see if I can replicate the issue.Oh thank you so much skyguy94!!! I look forward to hear from it!
↧
Updated Wiki: Home
Project Description: R.NET enables the .NET Framework to interoperate with the R statistical language in the same process. R.NET requires .NET Framework 4 and the native R DLLs installed with the R environment. R.NET works on Windows, Linux and MacOS. Enjoy statistics and programming in your special language with R.
You should head for the documentation to get started with R.NET.
2014-11-16 R.NET source code reference repository is now hosted on GitHub. This has been requested by several contributors amongst other things to facilitate pull requests.
2014-06-17 Thanks to Evelina Gabasova for documenting Setting up R.NET on Mac
2014-05-23 Version 1.5.13 is available on nuget.org. Note that the package identifier is R.NET.Community
https://www.nuget.org/packages?q=R.NET.Community
Program.cs
You should head for the documentation to get started with R.NET.
News
2014-12-18 Release of the R package rClr 0.7-2 at rClr. This is a significant release due to the fact that all unit tests that can pass using Mono indeed pass.2014-11-16 R.NET source code reference repository is now hosted on GitHub. This has been requested by several contributors amongst other things to facilitate pull requests.
2014-06-17 Thanks to Evelina Gabasova for documenting Setting up R.NET on Mac
2014-05-23 Version 1.5.13 is available on nuget.org. Note that the package identifier is R.NET.Community
NuGet Packages
2014-12: After several releases in the R.NET 1.5 series, and related F# and graphics tools, the following location should be used to get the latest packages. Note that if you use the key R.NET instead of R.NET.Community you will also get the older package feeds.https://www.nuget.org/packages?q=R.NET.Community
Known Issues
- There are persisting issues running R.NET from an ASP.NET application. The exact cause remains unclear, but this may be a inherent limitation of the R native engine with respect to thread safety.
- Custom startup parameters when initializing the engine are ignored on Windows. The main drawback is memory limitations to 2GB. There will be at least a partial workaround for the next version.
Whetting the appetite
- The example below gives a flavour of how R.NET works from C#. You should head for the documentation to really get started with R.NET. Examples of programming styles mixing C# and R are also available at the Examples page.
Program.cs
using System; using System.Linq; using RDotNet; namespace Sample1 { class Program { staticvoid Main(string[] args) { REngine.SetEnvironmentVariables(); // There are several options to initialize the engine, but by default the following suffice: REngine engine = REngine.GetInstance(); // .NET Framework array to R vector. NumericVector group1 = engine.CreateNumericVector(newdouble[] { 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(); Console.WriteLine("Group1: [{0}]", string.Join(", ", group1)); Console.WriteLine("Group2: [{0}]", string.Join(", ", group2)); Console.WriteLine("P-value = {0:0.000}", p); // you should always dispose of the REngine properly.// After disposing of the engine, you cannot reinitialize nor reuse it engine.Dispose(); } } }
Related Projects
- R to CLR: an R package to access .NET (CLR) objects from R, complementing R.NET. If you are looking to access .NET code from R interactively, you should consider this package.
- F# R Provider: an F# library that provides static typed functions exposed by R packages, using the type provider mechanism of F#.
↧
Closed Issue: R.Net favors the installer registry key over R_HOME [140]
I think this behavior is incorrect as R depends on R_HOME internally. What R.Net should be doing is looking for R_HOME and then building rPath from that. This way both R and R.Net's library loading are in sync.
One of the issues with the current approach is that R.Net will not correctly use a private build (ie: one not installed via the Windows installer) without overriding the R.Net behavior.
Overriding the behavior is unnecessary if the logic were fixed to favor R_HOME over the installer value.
Comments: Released with R.NET 1.5.19
One of the issues with the current approach is that R.Net will not correctly use a private build (ie: one not installed via the Windows installer) without overriding the R.Net behavior.
Overriding the behavior is unnecessary if the logic were fixed to favor R_HOME over the installer value.
Comments: Released with R.NET 1.5.19
↧
↧
Closed Issue: Periodic parse error when static wrapper class is used in multitask project (multithread) [79]
Hello. I have strange error in my code, which I get episodically: "An exception of type 'RDotNet.ParseException' occurred in RDotNet.dll but was not handled in user code".
Sometimes code works correct, sometimes - not.
Console gave me this message "Error: C stack usage is too close to the limit".
This is my dummy code (I cut it from my other big project, where I use R.NET) - as an example.
```
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RDotNet;
using RDotNet.Devices;
using RDotNet.Dynamic;
using RDotNet.Internals;
using RDotNet.NativeLibrary;
using System.IO;
using System.Threading;
using System.Collections.Generic;
namespace R_Test_Project
{
public static class RNetFactory
{
public static SemaphoreSlim augmentedRNetLocker = new SemaphoreSlim(1, 1);
private static string envPath = Environment.GetEnvironmentVariable("PATH");
private static string rBinPath = @"C:\Program Files\R\R-3.0.2\bin\x64";
private static REngine engine;
static RNetFactory()
{
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath);
engine = REngine.CreateInstance("RDotNet");
#region R Initialize
engine.Initialize();
engine.Evaluate(@"C:\Program Files\R\R-3.0.2\library");
engine.Evaluate("library(signal)");
engine.Evaluate("library(dlm)");
engine.Evaluate("library(circular)");
engine.Evaluate("library(fume)");
engine.Evaluate("library(stats)");
engine.Evaluate("library(MASS)");
engine.Evaluate("library(nlme)");
engine.Evaluate("library(astsa)");
engine.Evaluate("library(wmtsa)");
engine.Evaluate("gc(verbose=FALSE)");
#endregion
}
public static void SetAndExecute(string RNETExpression, NumericVector dataVector, string RNETVectorName)
{
SetVector(dataVector, RNETVectorName);
Execute(RNETExpression);
}
public static void SetVector(NumericVector dataVector, string RNETVectorName)
{
NumericVector vec = engine.CreateNumericVector(dataVector.Select<double, double>(x => { return (double)x; }));
engine.SetSymbol(RNETVectorName, vec);
}
public static void Execute(string RNETExpression)
{
engine.Evaluate(RNETExpression);
}
public static NumericVector GetVector(string RVectorName)
{
return engine.GetSymbol(RVectorName).AsNumeric();
}
}
class Kalman
{
private NumericVector randomVector;
public NumericVector DynamicVectorCreation()
{
RNetFactory.Execute("vecLength <- as.integer(5000 * runif(1, min = 0, max = 1)) + 50");
RNetFactory.Execute("data <- rnorm(vecLength, 0, 1)");
return RNetFactory.GetVector("data");
}
public NumericVector KalmanExecution(NumericVector rawDataVector)
{
RNetFactory.SetVector(rawDataVector, "rawSeries");
RNetFactory.Execute("mu0 <- 0; sigma0 <- 1000000; phi <- 1; cQ <- 1; cR <- 1");
RNetFactory.Execute("ks <- Ksmooth0(length(rawSeries), rawSeries, 1, mu0, sigma0, phi, cQ, cR)");
RNetFactory.Execute("kalmanSmoothedSeries <- as.vector(ks$xs)");
return RNetFactory.GetVector("kalmanSmoothedSeries");
}
}
class Program
{
static void Main(string[] args)
{
List<Task> allTasks = new List<Task>();
for (int i=0; i<50; i++)
{
allTasks.Add(new Task(() =>
{
var kalman = new Kalman();
RNetFactory.augmentedRNetLocker.Wait();
var rawData = kalman.DynamicVectorCreation();
RNetFactory.augmentedRNetLocker.Release();
Task.Delay(30);
RNetFactory.augmentedRNetLocker.Wait();
var refinedData = kalman.KalmanExecution(rawData);
RNetFactory.augmentedRNetLocker.Release();
}));
allTasks.Last().Start();
}
Task.WaitAll(allTasks.ToArray());
}
}
}
```
Sometimes code works correct, sometimes - not.
Console gave me this message "Error: C stack usage is too close to the limit".
This is my dummy code (I cut it from my other big project, where I use R.NET) - as an example.
```
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RDotNet;
using RDotNet.Devices;
using RDotNet.Dynamic;
using RDotNet.Internals;
using RDotNet.NativeLibrary;
using System.IO;
using System.Threading;
using System.Collections.Generic;
namespace R_Test_Project
{
public static class RNetFactory
{
public static SemaphoreSlim augmentedRNetLocker = new SemaphoreSlim(1, 1);
private static string envPath = Environment.GetEnvironmentVariable("PATH");
private static string rBinPath = @"C:\Program Files\R\R-3.0.2\bin\x64";
private static REngine engine;
static RNetFactory()
{
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath);
engine = REngine.CreateInstance("RDotNet");
#region R Initialize
engine.Initialize();
engine.Evaluate(@"C:\Program Files\R\R-3.0.2\library");
engine.Evaluate("library(signal)");
engine.Evaluate("library(dlm)");
engine.Evaluate("library(circular)");
engine.Evaluate("library(fume)");
engine.Evaluate("library(stats)");
engine.Evaluate("library(MASS)");
engine.Evaluate("library(nlme)");
engine.Evaluate("library(astsa)");
engine.Evaluate("library(wmtsa)");
engine.Evaluate("gc(verbose=FALSE)");
#endregion
}
public static void SetAndExecute(string RNETExpression, NumericVector dataVector, string RNETVectorName)
{
SetVector(dataVector, RNETVectorName);
Execute(RNETExpression);
}
public static void SetVector(NumericVector dataVector, string RNETVectorName)
{
NumericVector vec = engine.CreateNumericVector(dataVector.Select<double, double>(x => { return (double)x; }));
engine.SetSymbol(RNETVectorName, vec);
}
public static void Execute(string RNETExpression)
{
engine.Evaluate(RNETExpression);
}
public static NumericVector GetVector(string RVectorName)
{
return engine.GetSymbol(RVectorName).AsNumeric();
}
}
class Kalman
{
private NumericVector randomVector;
public NumericVector DynamicVectorCreation()
{
RNetFactory.Execute("vecLength <- as.integer(5000 * runif(1, min = 0, max = 1)) + 50");
RNetFactory.Execute("data <- rnorm(vecLength, 0, 1)");
return RNetFactory.GetVector("data");
}
public NumericVector KalmanExecution(NumericVector rawDataVector)
{
RNetFactory.SetVector(rawDataVector, "rawSeries");
RNetFactory.Execute("mu0 <- 0; sigma0 <- 1000000; phi <- 1; cQ <- 1; cR <- 1");
RNetFactory.Execute("ks <- Ksmooth0(length(rawSeries), rawSeries, 1, mu0, sigma0, phi, cQ, cR)");
RNetFactory.Execute("kalmanSmoothedSeries <- as.vector(ks$xs)");
return RNetFactory.GetVector("kalmanSmoothedSeries");
}
}
class Program
{
static void Main(string[] args)
{
List<Task> allTasks = new List<Task>();
for (int i=0; i<50; i++)
{
allTasks.Add(new Task(() =>
{
var kalman = new Kalman();
RNetFactory.augmentedRNetLocker.Wait();
var rawData = kalman.DynamicVectorCreation();
RNetFactory.augmentedRNetLocker.Release();
Task.Delay(30);
RNetFactory.augmentedRNetLocker.Wait();
var refinedData = kalman.KalmanExecution(rawData);
RNetFactory.augmentedRNetLocker.Release();
}));
allTasks.Last().Start();
}
Task.WaitAll(allTasks.ToArray());
}
}
}
```
↧
Closed Issue: Crazy mono glibc detected error [75]
I am using the jperraud branch and just tried to load R on CentOS using the new initialization that passes in strings ( this was to test/avoid the whole --no-save/-vanilla stuff). When I tried this I received the following error:
*** glibc detected *** mono-sgen: double free or corruption (fasttop):
Followed by a very long debug list and signs that this occurred in the constructor/initialization call. Examining the string as argumetns being passed, I found this was being passed:
rdotnet_app --slave --interactive --no-save --no-restore-data --max-ppsize=50000
Changing this to remove the interactive bit as:
rdotnet_app --quiet --slave --no-save --no-restore-data --max-ppsize=50000
Seemed to avoid the bad memory pointer free (whch I gather is what the glibc detected thing was). I have no idea what caused this, but it seems here might be a problem with conflicting arguments or god knows what.
*** glibc detected *** mono-sgen: double free or corruption (fasttop):
Followed by a very long debug list and signs that this occurred in the constructor/initialization call. Examining the string as argumetns being passed, I found this was being passed:
rdotnet_app --slave --interactive --no-save --no-restore-data --max-ppsize=50000
Changing this to remove the interactive bit as:
rdotnet_app --quiet --slave --no-save --no-restore-data --max-ppsize=50000
Seemed to avoid the bad memory pointer free (whch I gather is what the glibc detected thing was). I have no idea what caused this, but it seems here might be a problem with conflicting arguments or god knows what.
↧
Closed Unassigned: Differences in Visual Studio 2010 and Visual Studio Express 2013 [133]
Reference: https://rdotnet.codeplex.com/releases/view/122854, https://rdotnet.codeplex.com/documentation
When I executed the sample "Hello World", it worked in Visual Studio 2010 but not in Visual Studio Express 2013.
REngine.GetInstance was non-existent in the Visual Studio Express 2013.
Both are using 1.5.15
Can you possibly explain this?
Thanks...
Comments: Not reproducible. GetInstance definitely now the means to get the engine. Probably dll version were incorrect.
When I executed the sample "Hello World", it worked in Visual Studio 2010 but not in Visual Studio Express 2013.
REngine.GetInstance was non-existent in the Visual Studio Express 2013.
Both are using 1.5.15
Can you possibly explain this?
Thanks...
Comments: Not reproducible. GetInstance definitely now the means to get the engine. Probably dll version were incorrect.
↧
Edited Issue: R engine not in a working state [130]
I am doing some predictions using R.NET - making data frames, running linear regression and then using predict method to obtain predictions. Everything run ok, until suddenly, I received (and received from then on):
```
RDotNet.EvaluationException: Unable to retrieve an R error message. Evaluating 'geterrmessage()' fails. The R engine is not in a working state.
```
What causes this, or how can I fix this - should I reinitialize the engine?
Thanks
```
RDotNet.EvaluationException: Unable to retrieve an R error message. Evaluating 'geterrmessage()' fails. The R engine is not in a working state.
```
What causes this, or how can I fix this - should I reinitialize the engine?
Thanks
↧
↧
Closed Unassigned: Holt-Winters fails when called via R.NET, while working normally with the R Console in some cases [125]
I am currently working on a Project where I pass a vector to R.Net from a C# Application in order to perform Holt-Winters on the data. In most cases (~99 of 100) it works, but sometimes it won´t work via R.NET.. If I take the used values and perform the same steps in the R Console, everything works fine.
I am quite clueless what is causing the problem. I get an "Optimization failed" Error from R when calling from R.NET.
My code is:
```
var salesIn = R.CreateNumericVector(product.Value);
R.SetSymbol("sales", salesIn);
R.Evaluate("istm =ts(sales, freq=52)");
try
{
R.Evaluate("t = HoltWinters(istm)");
R.Evaluate("p = predict(t,3)");
R.Evaluate("output = as.numeric(p)");
var salesPrediction = R.GetSymbol("output").AsInteger().ToArray();
predictions.Add(product.Key, salesPrediction);
}
catch
{
predictions.Add(product.Key, null);
}
```
product.Value is a double vector with 148 values, in the case where it works on the console but not with R.NET the values are (here as integers from the database, i tried both, the datatype does´nt seem to be the problem):
37
58
25
25
57
50
38
68
14
21
45
24
11
54
46
54
38
45
52
49
31
53
32
31
24
50
66
30
20
58
61
34
42
37
52
37
42
45
58
51
50
65
63
54
44
37
28
44
113
27
43
35
43
59
43
112
37
40
28
26
47
75
59
49
44
21
47
62
66
62
47
117
56
47
34
65
81
79
114
47
10
51
65
69
64
44
72
61
90
64
78
69
76
108
60
87
73
87
100
58
69
44
41
92
83
55
68
79
69
67
44
92
66
38
95
34
79
63
84
59
73
100
102
84
83
84
90
58
110
61
37
50
55
70
17
31
81
68
43
105
104
94
80
115
54
61
47
54
117
Comments: Remaining follow up action is in issue https://rdotnet.codeplex.com/workitem/126
I am quite clueless what is causing the problem. I get an "Optimization failed" Error from R when calling from R.NET.
My code is:
```
var salesIn = R.CreateNumericVector(product.Value);
R.SetSymbol("sales", salesIn);
R.Evaluate("istm =ts(sales, freq=52)");
try
{
R.Evaluate("t = HoltWinters(istm)");
R.Evaluate("p = predict(t,3)");
R.Evaluate("output = as.numeric(p)");
var salesPrediction = R.GetSymbol("output").AsInteger().ToArray();
predictions.Add(product.Key, salesPrediction);
}
catch
{
predictions.Add(product.Key, null);
}
```
product.Value is a double vector with 148 values, in the case where it works on the console but not with R.NET the values are (here as integers from the database, i tried both, the datatype does´nt seem to be the problem):
37
58
25
25
57
50
38
68
14
21
45
24
11
54
46
54
38
45
52
49
31
53
32
31
24
50
66
30
20
58
61
34
42
37
52
37
42
45
58
51
50
65
63
54
44
37
28
44
113
27
43
35
43
59
43
112
37
40
28
26
47
75
59
49
44
21
47
62
66
62
47
117
56
47
34
65
81
79
114
47
10
51
65
69
64
44
72
61
90
64
78
69
76
108
60
87
73
87
100
58
69
44
41
92
83
55
68
79
69
67
44
92
66
38
95
34
79
63
84
59
73
100
102
84
83
84
90
58
110
61
37
50
55
70
17
31
81
68
43
105
104
94
80
115
54
61
47
54
117
Comments: Remaining follow up action is in issue https://rdotnet.codeplex.com/workitem/126
↧
Closed Issue: Problems when R runs on other threads [71]
In mono, if a thread from the thread pool uses the REngine, several errors about a limited stack size appear. This is described in section 8.1.5 of http://cran.r-project.org/doc/manuals/R-exts.pdf
One option is to disable the thread checking as described there, or check the stack size in .NET
One option is to disable the thread checking as described there, or check the stack size in .NET
↧
Closed Unassigned: RDOTNET and RSTUDIO [138]
Hello,
I am just starting with RDotNet and I would like to know if there is any chance to combine RDOTNET and RSTUDIO. What I mean is, I would like to develop C# app that is able to send data to a RStudio Session.
In this way I would be able to send data from c# to RStudio and have mix environment where i can test things in RStudio on the fly....and then update my c# code...
thank you...
Nelson Silva
Comments: Not feasible
I am just starting with RDotNet and I would like to know if there is any chance to combine RDOTNET and RSTUDIO. What I mean is, I would like to develop C# app that is able to send data to a RStudio Session.
In this way I would be able to send data from c# to RStudio and have mix environment where i can test things in RStudio on the fly....and then update my c# code...
thank you...
Nelson Silva
Comments: Not feasible
↧
Edited Unassigned: Remove Old R.Net 1.5.5 from NuGet [126]
It would be nice if this package went away. Can RecycleBin or another owner file a NuGet support request to have it removed? I don't believe there's a good reason, other than forcing people to upgrade, to keep it around. It does seem to cause some support issues.
↧
↧
Closed Issue: R.NET 1.5.5 on FreeBSD with MonoDevelop 4.0.12 does not work. [83]
I tested R.NET 1.5.5 on FreeBSD with MonoDevelop 4.0.12. It does not work.
The following line throws exceptions shown below:
line 43 of RDotNet.NativeLibrary.UnmanagedDll.cs: IntPtr handle = LoadLibrary(dllName);
```
System.EntryPointNotFoundException: LoadLibrary
at at (wrapper managed-to-native) RDotNet.NativeLibrary.UnmanagedDll:LoadLibrary (string)
at RDotNet.NativeLibrary.UnmanagedDll..ctor (System.String dllName) [0x0003c] in /home/freebsd/Workspace/rdotnet/RDotNet.NativeLibrary/UnmanagedDll.cs:43
at RDotNet.REngine..ctor (System.String id, System.String dll) [0x00000] in /home/freebsd/Workspace/rdotnet/R.NET/REngine.cs:43
at RDotNet.REngine.CreateInstance (System.String id, System.String dll) [0x000ab] in
...
```
I have libR.so correctly located in /usr/local/lib/R/lib and the R_HOME is set to /usr/local/lib/R. string rDll = "/usr/local/lib/R/lib/libR.so" is also passed to REngine.CreateInstance("RENGINE", rDll). It still fails with the same exception.
I notice that the region between the compiler directives #if UNIX and #endif are greyed out in MonoDevelop. It seems that the #if UNIX is not working as it is hoped to do. I tried commenting out and force the following line to be used:
```
[DllImport("libdl")]
private static extern IntPtr dlopen([MarshalAs(UnmanagedType.LPStr)] string filename, int flag);
```
This time, DllNotFoundException is thrown instead. It seems "libdl" cannot be found. Any suggustions?
Comments: Fixed with nuget releases up to 1.5.19
The following line throws exceptions shown below:
line 43 of RDotNet.NativeLibrary.UnmanagedDll.cs: IntPtr handle = LoadLibrary(dllName);
```
System.EntryPointNotFoundException: LoadLibrary
at at (wrapper managed-to-native) RDotNet.NativeLibrary.UnmanagedDll:LoadLibrary (string)
at RDotNet.NativeLibrary.UnmanagedDll..ctor (System.String dllName) [0x0003c] in /home/freebsd/Workspace/rdotnet/RDotNet.NativeLibrary/UnmanagedDll.cs:43
at RDotNet.REngine..ctor (System.String id, System.String dll) [0x00000] in /home/freebsd/Workspace/rdotnet/R.NET/REngine.cs:43
at RDotNet.REngine.CreateInstance (System.String id, System.String dll) [0x000ab] in
...
```
I have libR.so correctly located in /usr/local/lib/R/lib and the R_HOME is set to /usr/local/lib/R. string rDll = "/usr/local/lib/R/lib/libR.so" is also passed to REngine.CreateInstance("RENGINE", rDll). It still fails with the same exception.
I notice that the region between the compiler directives #if UNIX and #endif are greyed out in MonoDevelop. It seems that the #if UNIX is not working as it is hoped to do. I tried commenting out and force the following line to be used:
```
[DllImport("libdl")]
private static extern IntPtr dlopen([MarshalAs(UnmanagedType.LPStr)] string filename, int flag);
```
This time, DllNotFoundException is thrown instead. It seems "libdl" cannot be found. Any suggustions?
Comments: Fixed with nuget releases up to 1.5.19
↧
Closed Issue: Cannot run unit tests on Linux (Debian) [40]
@ rvision 294
Mono JIT compiler version 3.2.8 (mono-3.2.8/b1e8599
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
RDotNet.CharacterVectorTest.TestCharacter:
SetUp : RDotNet.EvaluationException : Unable to retrieve an R error message. Evaluating 'geterrmessage()' fails. The R engine is not in a working state.
```
at RDotNet.REngine.get_LastErrorMessage () [0x00000] in <filename unknown>:0
at RDotNet.REngine.Parse (System.String statement, System.Text.StringBuilder incompleteStatement) [0x00000] in <filename unknown>:0
at RDotNet.REngine+<Defer>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.Last[SymbolicExpression] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.LastOrDefault[SymbolicExpression] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at RDotNet.REngine.Evaluate (System.String statement) [0x00000] in <filename unknown>:0
at RDotNet.RDotNetTestFixture.SetUpTest () [0x00000] in <filename unknown>:0
```
Also, the terminal shows: Error: C stack usage is too close to the limit
Also crashes:
```
nunit-console4 src/codeplex/rdotnet/RDotNet.Tests/bin/Debug/RDotNet.Tests.dll
```
Comments: Still having issues, but not for the same reasons. Not worth keeping this issue opened to capture things.
Mono JIT compiler version 3.2.8 (mono-3.2.8/b1e8599
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
RDotNet.CharacterVectorTest.TestCharacter:
SetUp : RDotNet.EvaluationException : Unable to retrieve an R error message. Evaluating 'geterrmessage()' fails. The R engine is not in a working state.
```
at RDotNet.REngine.get_LastErrorMessage () [0x00000] in <filename unknown>:0
at RDotNet.REngine.Parse (System.String statement, System.Text.StringBuilder incompleteStatement) [0x00000] in <filename unknown>:0
at RDotNet.REngine+<Defer>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.Last[SymbolicExpression] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.LastOrDefault[SymbolicExpression] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at RDotNet.REngine.Evaluate (System.String statement) [0x00000] in <filename unknown>:0
at RDotNet.RDotNetTestFixture.SetUpTest () [0x00000] in <filename unknown>:0
```
Also, the terminal shows: Error: C stack usage is too close to the limit
Also crashes:
```
nunit-console4 src/codeplex/rdotnet/RDotNet.Tests/bin/Debug/RDotNet.Tests.dll
```
Comments: Still having issues, but not for the same reasons. Not worth keeping this issue opened to capture things.
↧
Commented Issue: DataFrameTest fails on Linux on second run within a same process [146]
Linux, Mono 3.12.1 built from master, 2014-11-09. R 3.2.1, Debian unstable.
nunit-gui; running DataFrameTest once is successful, second time crashes the process (not sure yet which test). A couple of error messages reported as follows. The first one reported is from the first run of the test in the class; the second one is followed by the native stack trace
```
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 10, 7
list()
data frame with 0 columns and 0 rows
```
So far as I can see, error is caused by
```c#
// public void TestDataFrameInMemoryCreation()
Assert.Throws(typeof(EvaluationException), (() => df = engine.CreateDataFrame(columns, columnNames: null)));
```
```c#
// in Function.cs
private ProtectedPointer evaluateCall(IntPtr call)
```
{System.ExecutionEngineException: SIGILL
at (wrapper managed-to-native) object:wrapper_native_0x7f0e61116f30 (intptr,intptr,bool&)
at RDotNet.Function.evaluateCall (IntPtr call) [0x00028] in /home/per202/src/
Comments: The same test DataFrameTest run from a console app other than nunit however seems to recover from the issue. This may be actually the way Nunit tests with Assert.Throws that causes the crash. Odd, and may be worth reporting if this is indeed the case.
nunit-gui; running DataFrameTest once is successful, second time crashes the process (not sure yet which test). A couple of error messages reported as follows. The first one reported is from the first run of the test in the class; the second one is followed by the native stack trace
```
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 10, 7
list()
data frame with 0 columns and 0 rows
```
So far as I can see, error is caused by
```c#
// public void TestDataFrameInMemoryCreation()
Assert.Throws(typeof(EvaluationException), (() => df = engine.CreateDataFrame(columns, columnNames: null)));
```
```c#
// in Function.cs
private ProtectedPointer evaluateCall(IntPtr call)
```
{System.ExecutionEngineException: SIGILL
at (wrapper managed-to-native) object:wrapper_native_0x7f0e61116f30 (intptr,intptr,bool&)
at RDotNet.Function.evaluateCall (IntPtr call) [0x00028] in /home/per202/src/
Comments: The same test DataFrameTest run from a console app other than nunit however seems to recover from the issue. This may be actually the way Nunit tests with Assert.Throws that causes the crash. Odd, and may be worth reporting if this is indeed the case.
↧