Skip to content
Prev 295521 / 398502 Next

How to evaluate R things from Visual Studio?

I'll answer line by line so:
I have.. I'm not sure why you seem so certain I didn't. But it is beside the 
point anyway
Folks who haven't used it won't be able to help me anyway.
People who did get it working will be able to help me, and those are the 
people I'm counting on.
The sole reason I did not disclose any R.NET related info is to avoid making 
an already large message, larger.
When I find someone, if I find someone who does have R.NET and can help me, 
I will gladly give any and all needed information
It's worth much, believe me. I really needed another person who got R.NET 
working.

It does work on R 2.12.0, I agree. but i need it to work any latest R.
I can't make my users use old and obsolete versions of R. And people have 
made it work on 2.15.0 (currently latest version) as well.
Can you please tell me exactly what string you put inside R_HOME and R_LIBS 
environment variables? (i.e. "C:\Progs\R\R-2.15.0\bin"? 
"C:\Progs\R\R-2.15.0"? what exactly?)
Also, it was YOU who created those Environmental Variables, right? Because 
they do not exist in my computer and i didn't delete them.
Safe to assume that we're talking about System -> Advanced -> Environment 
Variables -> System Variables. correct?
I've already read every page on rdotnet.codeplex.com

Of course there are. I need not repeat myself. I explained above why no 
direct R.NET info were given.

Now that I have found one guy who has R.NET working, I shall :)

My R version is: 2.15.0 and is installed on "C:\Progs\R\R-2.15.0" instead of 
"C:\Program Files\R\R-2.15.0" (but it doesnt work on that either, tried it)

The code I try to run on R.NET version 1.4.1 (changeset 6d2c3f161801) is the 
example they have on the official page:

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) 
Handles MyBase.Load
            Dim Rdo As REngine = REngine.CreateInstance("RDotNet", "-q") ' 
quiet mode

            ' .NET Framework array to R vector.
            Dim group1 As NumericVector = Rdo.CreateNumericVector(New 
Double() {30.02, 29.99, 30.11, 29.97, 30.01, 29.99})
            Rdo.SetSymbol("group1", group1)

            ' Direct parsing from R script.
            Dim group2 As NumericVector = Rdo.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.
            Dim testResult As GenericVector = Rdo.Evaluate("t.test(group1, 
group2)").AsList()

            Dim p As Double = testResult("p.value").AsNumeric().First()
    End Sub

The Error i get is this:
System.DllNotFoundException: Dll was not found.
   at RDotNet.NativeLibrary.UnmanagedDll..ctor(String dllName) in 
C:\Users\N1h1l1sT\Downloads\rdotnet_6d2c3f161801\RDotNet.NativeLibrary\UnmanagedDll.cs:line 
42
   at RDotNet.REngine..ctor(String id, String dll)
   at RDotNet.REngine.CreateInstance(String id, String dll)
   at RAttemptFour.Form1.Form1_Load(Object sender, EventArgs e) in 
C:\Users\N1h1l1sT\Dropbox\Visual Basic 2010\Test 
Projects\RAttemptFour\RAttemptFour\Form1.vb:line 35

No matter what i put inside the HOME or R_Home environment variables on my 
windows, it just won't work...
the line 35 refers to this line: "Dim Rdo As REngine = 
REngine.CreateInstance("RDotNet", "-q") ' quiet mode"

-------------------------------------------------------------------------------
Giannis Mamalikidis
e-mail: Giannis_Mamalikidis at msn.com
Member of the STAINS Research Group
(STAtistics & INformation Systems Group) of the
Aristotle University of Thessaloniki
Site: http://stains.csd.auth.gr
B.Sc Student in Electrical and Mechanical Engineering