Dear all,
 
I write this message because I have a problem in data importation. I hope that you help me. 
My data base is in an Excel spreasheet. I import this data base using the following code:
library(RODBC) 
db <- "C:/Users/Axel/Desktop/estimation/data.xls" 
channel <- odbcConnectExcel(xls.file = db) 
data <- sqlFetch(channel = channel, sqtable = "Feuil1") 
data 
odbcClose(channel)
 
Then I perform an lm regression using the following code:
reg1 <-lm(data$prod~data$pri+data$cli) 
summary(reg1)
 
Then I try to perform a gls regression because I have a correlation problem. For this I use the following code:
reg1gls <- gls(data$prod ~ data$pri + data$cli + 
correlation=corAR1(form= ~data$Year), method='ML')
 
The problem is that after this gls regression, I have the fellowing error message :
 
Error in eval(expr, envir, enclos) :  'Year' object is not find 
 
When I relplace "Year" by 1 in the gls formula, I have a second error message 
Error in eval(expr, envir, enclos) :  'prod' object is not find 
 
So I do not understand why R is able to extract variable from my data base with an lm object but it is not able to do it with the gls object. 
 
Do you have an idea about this problem?
Many thanks in advance.
 


      
	[[alternative HTML version deleted]]


