This project is read-only.

How to get "User Function Code" Via R.NET?

Feb 16, 2015 at 7:01 AM
Hi
I'm trying to make windowsform application with R.NET

I want to browse function code on windows application via R.NET
I make this sample code

Sample Code
Imports RDotNet
Module Module1

    Sub Main()
        Dim engine = REngine.GetInstance()
        Dim userFunction As RDotNet.Closure
        engine.Evaluate("sampleFunction <- function(a,b){c <- a*b;print(c)}")
        userFunction = engine.Evaluate("sampleFunction").AsFunction
        MsgBox(userFunction.ToString)
    End Sub

End Module
I excuse this program, but property and methods in RDotNet.Closure Object are complex for me.

I want to get function definition via R.NET same as R Console screen.


R Console Screen
> sampleFunction <- function(a,b){c <- a*b;print(c)}
> sampleFunction(10,10)
[1] 100
> sampleFunction
function(a,b){c <- a*b;print(c)}
How can I get result same like a R.Console Via R.NET?

please suggest

thanks in advance
YAKUMO

My Environment
  • Windows7
  • VisualBasic (.net Framework 4.0)
  • R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
  • R.NET 1.5.21.0
Feb 16, 2015 at 7:22 AM
I want to get this part from R via R.NET
function(a,b){c <- a*b;print(c)}
YAKUMO
Feb 22, 2015 at 5:30 PM
I'm sorry, I can't understand what you are asking for? Have you read the R.Net documentation?