Hello, and apologies for not providing an example. However, my question is more general.
I have a lengthy function. This function is using another internal function that modifies the data frame I am reading in. This internal function is using the command model.frame (with data and weights inside) and returns a data frame I am using for further analyses. However, when I try to run my function (which has an lm or a glm commmand) using that new data frame and separately defined weights, I get an error: can't find your weights object. This happens despite the fact that I actually print the weights object right before the glm command. The object is there - I can see it using ls(). I checked and rechecked - there are no typos. Interestingly, this happens only when I run it as a function. When I rename my arguments, go inside the function and run it line by line - I don't get this problem. Clearly, something is happening with my weights in the function environment. I was thinking - can it be that once I've used model.frame - everything else - like glm and lm - is confused as to what the weights are and doesn't want to take the weights I hand over to it but is looking for them elsewhere? Thank you! Dimitri -- Dimitri Liakhovitski gfk.com <http://marketfusionanalytics.com/> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.