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

Martin Maechler maechler at stat.math.ethz.ch
Wed Aug 25 14:00:34 CEST 1999


>>>>> On 25 Aug 1999 13:40, Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> said:

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

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

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

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

Well, I'd advocate strongly to improve  match.fun() in such a way.
As far as I remember, match.fun() was introduced exactly for the purpose
to be used as a simple reliable UI function
to handle all the search()/substitute/name clashes, etc.etc

This is also one of the things whose fix we'll probably have to postpone to
0.65.1 

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