As the R very beginner I'd like to ask if anyone could help me with the following problem?

library(foreign)
reg1 <- read.spss("URL of the spss file")
library(nlme)
model1 <- gls(v1 ~ x1 + x2 + x3 + x4 + x5 + x6, correlation=corARMA(p=1), data=reg1)


All the variables v1 to x6 are present in the spss file. Thanks in advance for help.

Thanks Nick. I can't share the file. I tried the procedure, but I got the similar result:

library(foreign)

library(nlme)

class(reg1) #check that it is indeed a data.frame [1] "data.frame"

colnames(reg1) #check that all column names are properly imported ....

[17] "x1" "x2" "x3" "x4"
[21] "x5" "x6"

....

[97] "...." "v1" "...." "...."

....

model1 <- gls(v1 ~ x1 + x2 + x3 + x4 + x5 + x6, correlation=corARMA(p=1), data=reg1)

• The error has indeed changed (v1 -> img4). It is not clear where this last error comes from, but: re-run your code, and right after you get the error, run traceback(). This might give you/us a hint on what's wrong (as it displays the call stack at the time of the error). – Nick Sabbe Jul 12 '11 at 12:32
• Well, actually I've 'debranded' the variables' names (so as the brands were impossible to identify). img4 is not a brand, but I also substituted the name of this variable for v1 writing my post. I just forgot to change it in the message about error. So, basically, the error has not changed. – robo Jul 12 '11 at 14:11
• It may be better to either show the actual code you ran, to avoid these kinds of confusions (all too often, an assumption during the 'translation' turns out to be the real culprit). Either way: I cannot debug this since I can't run it, so your only option is to use the traceback, or do actual debugging. – Nick Sabbe Jul 12 '11 at 14:27

From the documentation of ?gls: data: an optional data frame
In relation, the documentation of ?read.spss shows a parameter to.data.frame, whose default is FALSE, so typically reg1 will be a list instead of a data.frame.
reg1 <- read.spss("URL of the spss file", to.data.frame=TRUE)