Problem in calling data.frame from VB.NET

1 message Options
Embed this post
Permalink
Javed Chaudhari

Problem in calling data.frame from VB.NET

Reply Threaded More More options
Print post
Permalink
Hi All

Please find the below code.

I have outputE0 and outputEmax as 2-D Arrays returned from R (equivalent to matrices in R terms) with 50 rows and 1 column.

Now when I am trying to create data frame using (data.frame syntax in R), I am getting only 1 single row with 2 columns instead of 50 rows.Ideally data.frame should combine both the matrices and give 1 single datastructure (matrix) with 50 rows and 2 columns.

Please share what is the problem or resolution.

Dim E0 As Object(,)
Dim Emax As Object(,)

Dim outputE0 As Object
Dim outputEmax As Object

Dim listE0 As New List(Of Double(,))
Dim listEmax As New List(Of Double(,))

RCon.SetSymbol("E0", E0)
RCon.Evaluate("E0<-matrix(rnorm(50,-1,10),ncol=1)")
outputE0 = RCon.GetSymbol("E0")
listE0.Add(CType(outputE0, Double(,)))

RCon.SetSymbol("Emax", Emax)
RCon.Evaluate("Emax<-matrix(rnorm(50,-1,10),ncol=1)")
outputEmax = RCon.GetSymbol("Emax")
listEmax.Add(CType(outputEmax, Double(,)))

RCon.SetSymbol("Df", Df)
RCon.Evaluate("Df<-data.frame(E0,Emax)")
outputDf = RCon.GetSymbol("Df")
listDf.Add(outputDf)

Thanks

Javed