It could be the fact that you are using the xlsreadwrite package. This may well 
be interfering with RExcel. 
Try it without "write.xls(totDat, "C:\\AAA.xls",colNames = FALSE,sheet = 1,from 
= 1,rowNames=NA ) ;"
and see if it works

You can use RExcel to write to an Excel spreadsheet anyhow!

Regards,

Wayne

 
 
 
 
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Santosh Mishra
Sent: 06 October 2008 08:50
To: R (D)COM and RExcel server related issues
Subject: Re: [Rcom-l] Sourcing R code from VBA


Thanks for the suggestion. However, the problem still remains. It is giving me 
the same error. I
Santosh

Santosh Mishra
Assistant Professor
Department of Economics
Oregon State University
Corvallis, OR, 97330


2008/10/6 < [EMAIL PROTECTED]>


Try Call RInterface.RunRFile("C:/Subodh/Prog/temprr.txt") or Call 
RInterface.RunRFile("C:\Subodh\Prog\temprr.txt")

instead of Call RInterface.RunRFile("C:\\Subodh\\Prog\\temprr.txt")

Regards

Wayne
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] Behalf Of Santosh Mishra
Sent: 06 October 2008 08:38
To: rcom-l@mailman.csd.univie.ac.at
Subject: [Rcom-l] Sourcing R code from VBA


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



_______________________________________________
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