[R] error message: "Error in model.frame"

Shravan Vasishth vasishth at julius.ling.ohio-state.edu
Thu Dec 20 16:16:41 CET 2001


Hi all,

All the files related to the question below are in

http://ling.ohio-state.edu/~vasishth/TempRdir/

I've been using a script (called newresiduals.R, the code is in the above
directory; I wanted to avoid cluttering up this message) that is run in
the following manner at the command prompt:

R --vanilla "wordlen-2-01-g1" < newresiduals.R

What it does is: it goes through a bunch of files with extension .dmp, and
(a) calculates residuals by doing residuals(lm(...)), using the vector
version of wordlen-2-01-g1 as the independent variable, and the vector
version of the third column of each .dmp file as the dependent variable,
(b) adds a new column to the original .dmp file, containing the residuals.

The above command is called from a shell script.

This code has worked fine all these days on hundreds of files, but with
the particular set I'm working with now, when I run the above command,
I get the error message:

> for (i in list.files(pattern = "*.dmp")) {
    currentfile <- read.table(i)
    vecrawrts <- as.vector(currentfile$V3)
    residuals <- residuals(lm(v .... [TRUNCATED]
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,
:
        invalid variable type
> traceback()
9: model.frame.default(formula = vecrawrts ~ vecwordlen,
drop.unused.levels = TRUE)
8: model.frame(formula = vecrawrts ~ vecwordlen, drop.unused.levels =
TRUE)
7: eval(expr, envir, enclos)
6: eval(mf, parent.frame())
5: lm(vecrawrts ~ vecwordlen)
4: residuals(lm(vecrawrts ~ vecwordlen))
3: eval.with.vis(expr, envir, enclos)
2: eval.with.vis(ei, envir)
1: source("newresiduals.R", echo = TRUE)
> ?model.frame.default

Can anyone help me figure out what's going wrong? The really odd thing is,
the output of the script appears to be perfectly OK, even though it halts
with this error message.

Here's my system configuration, in case this is relevant:

> version
         _
platform powerpc-unknown-linux-gnu
arch     powerpc
os       linux-gnu
system   powerpc, linux-gnu
status
major    1
minor    3.1
year     2001
month    08
day      31
language R

Thanks very much in advance,

-- 
Shravan Vasishth
Dept. of Linguistics, OSU
222 Oxley Hall, 1712 Neil Ave.
Columbus, OH 43210-1298
USA

URL: http://ling.ohio-state.edu/~vasishth



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list