[Rd] assignment

2021-12-27 Thread Gabor Grothendieck
In a recent SO post this came up (changed example to simplify it here). It seems that `test` still has the value sin. test <- sin environment(test)$test <- cos test(0) ## [1] 0 It appears to be related to the double use of `test` in `$<-` since if we break it up it works as expected:

[Rd] Why does lm() with the subset argument give a different answer than subsetting in advance?

2021-12-27 Thread Balise, Raymond R
Hello R folks, Today I noticed that using the subset argument in lm() with a polynomial gives a different result than using the polynomial when the data has already been subsetted. This was not at all intuitive for me.You can see an example here: https://stackoverflow.com/questions/70490599

Re: [Rd] Why does lm() with the subset argument give a different answer than subsetting in advance?

2021-12-27 Thread Ben Bolker
I agree that it seems non-intuitive (I can't think of a design reason for it to look this way), but I'd like to stress that it's *not* an information leak; the predictions of the model are independent of the parameterization, which is all this issue affects. In a worst case there might be som

Re: [Rd] [External] assignment

2021-12-27 Thread luke-tierney
On Mon, 27 Dec 2021, Gabor Grothendieck wrote: In a recent SO post this came up (changed example to simplify it here). It seems that `test` still has the value sin. test <- sin environment(test)$test <- cos test(0) ## [1] 0 It appears to be related to the double use of `test` in `$<-` sin