[R] Call to glm inside a function
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Feb 17 19:59:06 CET 2003
ZABALZA-MEZGHANI Isabelle wrote:
>
> Hello,
>
> I want to call glm inside a function. In the first lines of code I build the
> weights, the formula, ... and then I call glm with the following command:
> glm(formularesp, data=data, family=familyresp,
> weights=eval(data$weights)
>
> My problem is that the fitting proccess is performed just like if
> weights=NULL, even if my weights are not equals to 1. I've performed some
> return() command before this glm call to check the value of each argument,
> and everything seems OK.
>
> Please, help me to understand why the code bypass my weighting instruction.
That's extremly hard, because you haven't told us what you *really* did.
Please provide a *short*, *reproducible* example. I guess you have got a
problem with scoping and specified the data in strange places, but
nothing I can see without more details. I presume you are on the recent
version of R, R-1.6.2 (please, tell it as well).
BTW: data() is an R function, thus it's not a good idea to use it as a
variable name.
Uwe Ligges
> Regards
>
> Isabelle
More information about the R-help
mailing list