Hi List,
Is there any way to pass on directly VBA variable content into a R variable? on windows XP & using R 2.12.0 I have installed RExcel addin (with associated D(COM)) >> It function fine when trying to pass Excel Range to R but I failed (sorry if >> it is only my own limitation, search till now unsuccessful) to find out how >> to pass directly VBA array into R Below an example - sorry it is VBA - including a very simple call to R >> The below code function perfectly, my question is: How could I pass directly >> DblArray into R variable "test" >> So it would be something like: Call RInterface.PutArray("test", DblArray) >> But as could be expected I have an error because the RInterface.PutArray() >> is expecting an Excel range as second argument Any hint very appreciated! Thanks & regards, Julien Cuisinier Sub Demo1() Dim i As Long Dim j As Long Dim Elements As Long Dim Start As Double Dim Length As Double Dim DblMedian As Double Dim DblArray() As Double Dim RngData As Range Dim RngData2 As Range Set RngData = Range("A1:A10") Set RngData2 = Range("B1") Elements = 100 ReDim DblArray(0 To Elements - 1) For i = 0 To Elements - 1 DblArray(i) = Rnd() Next i Start = Timer Call RInterface.StartRServer Call RInterface.PutArray("test", RngData) Call RInterface.RRun("z<-median(test)") Call RInterface.GetArray("z", RngData2) Call RInterface.StopRServer 'Range("B1") = RngData2 Length = Length + Timer - Start Debug.Print Length End Sub [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.