[R] Error in get(x, envir, mode, inherits)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Aug 25 09:59:43 CEST 1999


On Wed, 25 Aug 1999, Murray Jorgensen wrote:

> I have reproduced the error with a smaller set of commands and a smaller
> data file on two PCs under both 0.64.1 and 0.64.2.

(and Windows, not that it matters here. But PCs also run R under Linux,
FreeBSD, ..., so please use bug.report() when reporting problems.)

> I have not reproduced it with an inbuilt data set (except where it has
> previously occured with my problem data.)

As a I got a private copy of this a couple of hours' ago, it is now solved.
The problem is that autoframe contains a column `length'.  There is a bug
in R that we will resolve, but for now, do not attach data frames with
columns called `length' and then try lm (or anything else using sapply).
Note that the attach here is both not needed and wasteful.  In general
attach can and probably should be avoided if possible.

> > autoframe <- read.table("f:/maj/R&Splus/auto2.txt", header=T)
> > attach(autoframe)
> > slm <- lm(price ~ engsize, autoframe)
> Error in get(x, envir, mode, inherits) : variable "FUN" was not found
[...] 

Using the data argument to lm puts autoframe at the top of the search
for variables in the model, weights, subsets, ....

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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