hello all
i am working on a windows vista platform. R2.5.1 is being used in conjuction
with office 2007.
the linker works fine but i have run into the following error. hopefully
some one can help.
i would like to use functions from one of the r libraries. the code is
below:
Sub stepsel()
'start Rexcel
Call rinterface.StartRServer
rinterface.rrun "library(leaps)"
j = 1
nshares = 500
nfactors = 39
Call rinterface.putArray("Data.xy", Range("db2").Offset(nshares * (j -
1), 0).Resize(nshares, 1 + nfactors))
rinterface.rrun "Data.y<-Data.xy[,1]"
rinterface.rrun "Data.x<-Data.xy[,-1]"
rinterface.rrun
"a=summary(regsubsets(x=Data.x,y=Data.y,int=FALSE,method=c('forward'),nbest=1,
nvmax=5))" 'PROBLEM LINE
Call rinterface.GetArray("a$adjr2", Range("ew2"))
'stop R
Call rinterface.StopRServer
End Sub
i get the following errors:
OLE error -2147221493
Method 'EvaluateNoReturn' of object 'IStatConnector' failed
-2147221493 evaluation stopped because of an error
Error when evaluating
a=summary(regsubsets(x=Data.x,y=Data.y,int=FALSE,method=c('forward'),nbest=1,
nvmax=5))
evaluation stopped because of an error
Error in leaps.setup(x, y, wt = weights, nbest = nbest, nvmax = nvmax, :
NA/NaN/Inf in foreign function call (arg 4)
WHEN i paste the following code inside excel and use the "RunR" tab , the
code works, so there hopefully is way for one to get the VBA version to
work!
library(leaps)
a=summary(regsubsets(x=Data.x,y=Data.y,int=FALSE,method=c("forward"),nbest=1,
nvmax=5))
--
Allan Clark
==================================
Lecturer in the Statistical Sciences Department
University of Cape Town
Rondebosch
7700
Cape Town
South Africa
_______________________________________________
Rcom-l mailing list
[email protected]
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at