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

New Post: Create multiple R instances on separate threads

$
0
0
OK no problems, I created a static instance of REngine and have been locking on it to ensure only 1 thread accesses at a time. I was hoping that R would at least allow multiple workspaces but no worries.

New Post: alternative to str() in source() to get full variable's output

Created Unassigned: R.NET for .net framework 4.5 [180]

$
0
0
I developed application in vb.net 2010, Windows enterprise 7.0 which runs r code. I have installed R.net libraries and the application runs perfect on my end.
However when I provide the setup file to run the application for persons who have .NET 4.5, the R part of the application does not run.

I was wondering is there an option that would enable R component of the code run in Windows 8 environment with .Net framework 4.5 or higher.

New Post: How to create list object in R.Net?

$
0
0
Dear R.Net expert,
   Can I ask how to I create a list object in R.net?
odpar <- list(mean = c(-1.5, 0, 1.5), var = c(0.5, 0.6, 0.8))

Thanks,

Ben

New Post: How to create list object in R.Net?

$
0
0
To be precise I need Named List Members in R.NET...is it currently support?

New Post: Serialize object from R

$
0
0
So, Is it possible to get lightweight version of SymbolicExpression, marked as Serializable?
Other question - If I need to realize RPC via TCP/IP or named pipes, what should I do? Is this any way to create dynamic proxy for REngine class which allow to create multiple instances of R (via different processes connected by TCP/IP through serialization data)?

New Post: How to create list object in R.Net?

New Post: How can I receive the message from R function?

$
0
0
In C#, I want to receive the message from R function.

For example, some function returns a value at last, but this function also returns some values in a progress. (Like a percentage of calculating progress...)

I want to take that message, and show the progress bar in C# Environment. Is that possible?

Created Unassigned: cannot launch jpeg device in mvc [181]

$
0
0
```
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
engine.Initialize();
engine.Evaluate("source('C:/Users/xi/Documents/Tencent Files/865253988/FileRecv/R/myFunction.R')");
var fn = engine.Evaluate("fn").AsFunction();
fn.Invoke();
engine.Dispose();
return View();
```
when I run this code ,i received an "Error in png(file = "contour.png")".Is it because graphic devices are not supported by r.net????

New Post: How can I receive the message from R function?

$
0
0
It is possible, but a fairly advanced thing to set up.

I've added a documentation page on one approach to it in .NET function callbacks from R. There are links to working sample code.

New Post: How can I receive the message from R function?

$
0
0
Oh thanks jperraud. It looks quite difficult for me, but it would help. :)

Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: I resolved the mentioned issue by copying all dll from "C:\Program Files\R\R-3.2.2\bin\i386" location to C:\Program Files\R\R-3.2.2\bin location

New Post: Create multiple R instances on separate threads

$
0
0
dwaterworth wrote:
OK no problems, I created a static instance of REngine and have been locking on it to ensure only 1 thread accesses at a time. I was hoping that R would at least allow multiple workspaces but no worries.
I guess we got the same answer, here I leave an explanation and an example for future reference: R.NET Multiple Instances

New Post: Create multiple R instances on separate threads

$
0
0
Hi,

Yes I pretty much did the same thing
   public static class R
    {
        static R()
        {
            Engine = REngine.GetInstance();
        }

        private R() {}

        public static REngine Engine { get; protected set; }
    }
lock (R.Engine) {
    R.Engine.ClearGlobalEnvironment();
    R.Engine.Evaluate(@"library(reshape2)");

    // etc.
}

New Post: What to concider running R.NET from ASP MVC?

$
0
0
I am currently building an ASP MVC application and I would like to allow users to kickstart concurrently R scripts that often can take a while to execute. I have already looked into using a framework like Hangfire for managing all the background tasks but has anyone in here tried to run R.NET in such an application and with those kind of requirements?

Any advice would be very useful.

Thanks

Created Unassigned: R.NET, invalid "track" package work [182]

$
0
0
Hello.

I found one problem when tried to work with "track" package. I really can't understand the reason of it, but...

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using RDotNet;
using RDotNet.NativeLibrary;
using RDotNet.Dynamic;

namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
var engine = REngine.GetInstance();

engine.Initialize();

engine.Evaluate("library(track);");
engine.Evaluate(@"track.start(clobber = ""vars"")");

engine.Evaluate("a <- 5;");
engine.Evaluate("print(track.summary());");
engine.Evaluate("print(ls(globalenv()));");

Console.ReadLine();


}
}
}
```
track.summary() doesn't work properly via R.NET.
This is execution result via R.NET:
```
Tracking <env R_GlobalEnv> (writable) using existing directory 'rdatadir'
[1] class mode extent length size modified TA TW
<0 строк> (или 'row.names' нулевой длины)
[1] "a"
```

This is execution result via R-3.2.2.x64

```
> library(track);
> track.start(clobber = "vars", dir = file.path(tempdir(), 'rdata123'));
Tracking <env R_GlobalEnv> (writable) using new directory 'C:\Users\Rebelion\AppData\Local\Temp\RtmpGmyc4B/rdata123'
>
> a <- 5;
> print(track.summary());
class mode extent length size modified TA TW
a numeric numeric [1] 1 48 2015-11-18 20:36:23 0 1
> print(ls(globalenv()));
[1] "a"
>
> track.stop();
Stopping tracking on <env R_GlobalEnv>

```

What's the reason of this difference in working?

Thank you.

Edited Unassigned: R.NET, invalid "track" package work [182]

$
0
0
Hello.

I found one problem when tried to work with "track" package. I really can't understand the reason of it, but...

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using RDotNet;
using RDotNet.NativeLibrary;
using RDotNet.Dynamic;

namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
var engine = REngine.GetInstance();

engine.Initialize();

engine.Evaluate("library(track);");
engine.Evaluate(@"track.start(clobber = ""vars"", dir = file.path(tempdir(), 'rdata12356'))");

engine.Evaluate("a <- 5;");
engine.Evaluate("print(track.summary());");
engine.Evaluate("print(ls(globalenv()));");

Console.ReadLine();


}
}
}
```
track.summary() doesn't work properly via R.NET.
This is execution result via R.NET:
```
Tracking <env R_GlobalEnv> (writable) using existing directory 'rdatadir'
[1] class mode extent length size modified TA TW
<0 строк> (или 'row.names' нулевой длины)
[1] "a"
```

This is execution result via R-3.2.2.x64

```
> library(track);
> track.start(clobber = "vars", dir = file.path(tempdir(), 'rdata123'));
Tracking <env R_GlobalEnv> (writable) using new directory 'C:\Users\Rebelion\AppData\Local\Temp\RtmpGmyc4B/rdata123'
>
> a <- 5;
> print(track.summary());
class mode extent length size modified TA TW
a numeric numeric [1] 1 48 2015-11-18 20:36:23 0 1
> print(ls(globalenv()));
[1] "a"
>
> track.stop();
Stopping tracking on <env R_GlobalEnv>

```

What's the reason of this difference in working?

Thank you.

New Post: What to concider running R.NET from ASP MVC?

$
0
0

Since there can only be one instance of R (via R.NET) running PER process, the answer is to use multiple processes.

New Post: How to return result from Rscript after execute code in R.NET

$
0
0
Dear Team
I have execute a script and which run without error and produce output, now I want to run same script in C# using R.NET it also execute properly but how to get result return from script ?

Please help !
here I am giving my script and C# code

My script
head(study123)
study123$lcmax<-log(study123$Cmax)
output<-aov(formula=lcmax~Treat,data=study123)
summary(output)
My C# code
            REngine.SetEnvironmentVariables();
            REngine engine = REngine.GetInstance();
            engine.Initialize();
            GenericVector testList = engine.Evaluate("source('D:/Rscript.r')").AsList();
            engine.Dispose();
How to fetch result from above code.
Here I got result from R
 Df Sum Sq Mean Sq F value  Pr(>F)   
Treat          1    3.7   3.732   8.747 0.00316 **
Residuals   1198  511.1   0.427                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Please help.

New Post: How to return result from Rscript after execute code in R.NET

$
0
0
You need to use same variable for summary.
Like this:
myResult <- summary(output);
Next step - you need to "parse" it. myResult is a list. Try to get values you need like you get myResult.
Viewing all 1634 articles
Browse latest View live


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