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

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Aug 25 13:40:00 CEST 1999


Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

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

A quick and ugly fix for this is to replace the call to match.fun in
lapply with

FUN <- eval.parent(substitute(match.fun(FUN)))

This also applies (!) to various other places that need to deal with
FUN arguments (apply, sapply, sweep, outer). It might be preferable to
make match.fun smarter, at the expense of making it completely
obscure.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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