Hello everyone
I am using RExcel, an add-in for R to use R within MS Excel workbook. The add-in is freely distributed by Statconn. Pls refer
http://www.statconn.com/
I need help to start writing VBA Macro to invoke and execute R to read .csv file.
This is the code what I made so far… but the compilation error was occured.
Public ActiveServerAtStart As Boolean
Sub Get_Value()
MsgBox "R putting data into excel"
Rinterface.StartRServer
Rinterface.RRun "z<-read.csv("F:\\mycsvfile.csv",header=TRUE)"
Rinterface.GetArray "z", Range("Sheet1!A1")
Rinterface.StopRServer
End Sub
Here “mycsvfile.csv” is target file from which the data is needed to be retrieved. Get_Value() is macro name for the active worksheet. I want to get the data to the sheet1 (cell A1) of active work sheet.
Thanks in advance.