excel.link
excel.link copied to clipboard
InitR
I am interested in trying to start R from within Excel. I found this in the Excel.link sample workbook, however, it appears that is not working. It opens Rterm but is frozen and can't type on it. Questions:
Can Rterm recognize the current workbook and interact with it?
In other words: Is it possible to make the RTerm window interactive within Excel? If so, can I type code on it to interact with the current spreadsheet? For example, can I type: plot(rnorm(10)) on Rterm and display a graphic?
Below is the code I found:
Public Sub InitR()
Dim strPath
Set objShell = CreateObject("Wscript.Shell")
strPath = r_home() & "/bin/" & Use32path & "/Rterm.exe"
Set objR = objShell.Exec("""" & strPath & """ " & rterm_params)
objR.StdIn.WriteLine ProcessInitString(InitString)
Application.Wait (Now + TimeValue("0:00:" & DelayBeforeHide))
Call HideWindow(objR.ProcessID)
End Sub