Skip to content

Environment of a LM created in a function

1 message · Thaler, Thorn, LAUSANNE, Applied Mathematics

#
Dear Peter,

Thanks for your concise answer, it works perfectly. 

By the way, I fully agree that "data" or "df" are not good names for
data.frames and I am/was aware of that and I usually avoid those names
(not consequently though I've to admit, it is too tempting ;). However,
if one uses those evil names, one cannot expect to receive meaningful
error messages. Thus, I was not astonished by the peculiar error message
itself (in fact I was well aware that this has to do with the bad naming
and the fact that "data" is, above all, a function) and I suspect the
error to be due to environment issues.

I tried the workaround with passing the very same data argument
explicitly to update:
which worked but which left the stale impression of redundancy and even
more dangerous error proneness: what happens if the name of the data
frame is changed earlier?

Finally, your suggestion with
solved all the issues (and I was wondering why I did not try it out
myself, so obviously I was not seeing the wood for the trees). So,
thanks a lot for your help.

Have a nice day.

KR,

-Thorn