Dear Friends,
 I am new to Rexcel, but I have worked in R for a while. I have a problem in
sourcing R code file from VBA.
Here is the code I am running in R.
## R code below
library(np);
library(gam);
library(xlsReadWrite);
data("Italy");
attach(Italy);
X <- data.frame(year=ordered(year))
y <- data.frame(gdp)
bw <- npcdensbw(xdat=X, ydat=y, tol=.1, ftol=.1)
fhat <- npcdens(bws=bw);
utotd<-fhat$condens;
write.xls(totDat, "C:\\AAA.xls",colNames = FALSE,sheet = 1,from =
1,rowNames=NA ) ;
############################################################################
XX<-cbind(rnorm(1008));
y1<-as.matrix(y);
gamformn<-formula(y1~s(XX));
nlin_fitn<-gam(formula = gamformn, family = gaussian, data =Italy,
 na.action = na.exclude, control = list(epsilon =    0.0001, bf.epsilon =
0.0001, maxit = 5000, bf.maxit = 1000, trace = F),x=TRUE,y=TRUE)
 tempjj2<-nlin_fitn$residuals;

## VBA macro used(the above code is stored in temprr.txt)
Sub Demo100()
    RInterface.StartRServer
 Call RInterface.RunRFile("C:\\Subodh\\Prog\\temprr.txt")
     RInterface.StopRServer
End Sub

 This is the error I am getting

*Error-2147220502 in Module RExcel.Rserver
Error Running Expression
eval(parse(text="source(.rexcel..xtoavnn)"))*

My hunch is that adding the GAM code is creating a problem. Because when I
use the np library (from beginning to ##########, it runs fine)

Note that the  whole  code is running fine in R. Any help will be highly
appreciated.
Best regards,
Santosh

Santosh Mishra
Assistant Professor
Department of Economics
Oregon State University
Corvallis, OR, 97330
_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at

Reply via email to