Skip to content
Prev 32842 / 63421 Next

(PR#13735) LM/GLM can't find weights vector from within a function

This seems to be as documented.  From ?lm

      All of 'weights', 'subset' and 'offset' are evaluated in the same
      way as variables in 'formula', that is first in 'data' and then in
      the environment of 'formula'.

We don't have a reproducible example and so do not know where rFormula 
was defined -- but it seems likely that W is not defined in its 
environment.  If you believe otherwise, we need a complete example.

Incidentally, str() reports that W is a 1D array, not a vector.
On Mon, 1 Jun 2009, gaidys at uol.com.br wrote: