How to convert R variable to Excel variable & vice versa

3 messages Options
Embed this post
Permalink
puspendra

How to convert R variable to Excel variable & vice versa

Reply Threaded More More options
Print post
Permalink
Hi
  I want to know some code about Rexcel. Please if you can respond, it will be great helpful for me. Problem is that the conversion of Excel (type of) variable to R (type of) variable. Suppose I have written the code in VBA.
 
Option Base 1
Sub test()
Dim x(5) As Integer
x(1) = 10
x(2) = 20
x(3) = 30
x(4) = 40
x(5) = 50

RInterface.StartRServer
   
RInterface.RRun "Nt<- x[3]"                       'I want to store 3rd element of an array by using R
                                                            '& also if possible I want to show this value by msgbox
RInterface.StopRServer
End Sub
 
I think x() array is an Excel type and we will have to convert it to R type of array i.e. vector. The question is How?
and again I want to perform some action on 'Nt' through excel VBA, then again we will have to convert this R type of Variable to Excel type.
Am i right?
Please suggest me some way how to do these things.
ryusuke

Re: How to convert R variable to Excel variable & vice versa

Reply Threaded More More options
Print post
Permalink
I would like to convert some codes from R to Excel as well, anyone can help????
puspendra

Re: How to convert R variable to Excel variable & vice versa

Reply Threaded More More options
Print post
Permalink
Please find the attached document, perhaps it might help..............
RExcel.doc