Re: [R] Environment of a LM created in a function

2011-08-02 Thread 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 ev

Re: [R] Environment of a LM created in a function

2011-07-31 Thread Peter Ehlers
I haven't seen an answer yet, so I'll give it a shot (below). On 2011-07-29 01:37, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote: Dear all, Quite often I have the situation that I've multiple response variables and I create Linear Models for them in a function. The following code illustrat

[R] Environment of a LM created in a function

2011-07-29 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Dear all, Quite often I have the situation that I've multiple response variables and I create Linear Models for them in a function. The following code illustrates my usual approach: ---8<--- set.seed(123) dat <- data.frame(x = rep(rep(1:3, each = 3), 4), y = rep(1:3, 12))