autstat Support
New to SExcel. Cant find any reference material anywhere. Lots for RExcel, but not for SEXcel.
I have a date in an Excel spreadsheet and I want to use that as a paramter to pass into an R Function in VBA.
So Id like to do something like GetData(range("C4")) where range("C4") has the date and GetData is an R procedure that I want to run using that date as the input parameter.
What is the VBA syntax?
Even better would be to call that function and return some data into range("D4").
How to do in VBA?
I have a date in an Excel spreadsheet and I want to use that as a paramter to pass into an R Function in VBA.
So Id like to do something like GetData(range("C4")) where range("C4") has the date and GetData is an R procedure that I want to run using that date as the input parameter.
What is the VBA syntax?
Even better would be to call that function and return some data into range("D4").
How to do in VBA?
2018-01-17 08:11
Arthur,
the material for RExcel is exactly what you need.
Concerning your question, please see the following Example:
Public Sub test1()
Dim RInterface As New SExcel.RInterface
RInterface.StartRServer
RInterface.PutArray "date1", Range("A1")
RInterface.RRun "date2<-date1+60*60*24"
RInterface.GetArray "date2", Range("A2")
RInterface.StopRServer
End Sub
To use multiple cells, try
Public Sub test1()
Dim RInterface As New SExcel.RInterface
RInterface.StartRServer
RInterface.PutArray "date1", Range("A1:C1")
RInterface.RRun "date2<-date1+60*60*24"
RInterface.GetArray "date2", Range("A2:C2")
RInterface.StopRServer
End Sub
You will have to add a reference to SExcel in your VBA project.
the material for RExcel is exactly what you need.
Concerning your question, please see the following Example:
Public Sub test1()
Dim RInterface As New SExcel.RInterface
RInterface.StartRServer
RInterface.PutArray "date1", Range("A1")
RInterface.RRun "date2<-date1+60*60*24"
RInterface.GetArray "date2", Range("A2")
RInterface.StopRServer
End Sub
To use multiple cells, try
Public Sub test1()
Dim RInterface As New SExcel.RInterface
RInterface.StartRServer
RInterface.PutArray "date1", Range("A1:C1")
RInterface.RRun "date2<-date1+60*60*24"
RInterface.GetArray "date2", Range("A2:C2")
RInterface.StopRServer
End Sub
You will have to add a reference to SExcel in your VBA project.
2018-01-17 09:33