0

I would like to use macros to run my Rexcel codes, so as to automate the process by the press of a button.

#!rput  zz  'Sheet1'!$B$2:$B$1112
library(forecast)       
zz <- ts(zz,freq=365,start=c(2007,121))     

arimaz<- auto.arima(zz,d=1)     
arimazP <- predict(arimaz,n.ahead=409)      
write.table(arimazP)

Currently I run both the codes by right clicking, and then pasting the output. I tried rercording a macro for this, but did not work out. Please help..

siddharth
  • 21
  • 2

1 Answers1

0

once you have the table arimazP,

    RInterface.GetArray "arimazP", Range("A1")

Edit: The following will be executed much more quickly. Actually, I wrote a Function that completely replaces the RInterface.GetArray (due to performance issues) for tables with/without row/column names. If anyone wants that let me know and I'll post it.

    Range("A1") = RInterface.GetRExpressionValueToVBA("arimazP")
hedgedandlevered
  • 2,314
  • 2
  • 25
  • 54