Re: [R] newdata for predict.lm() ??

2020-11-04 Thread Boris Steipe
Solved. Thanks Achim and Peter ... though following that approach we now are relying implicitly on column names. But at least I've got this silly example working now. Thanks for the explanation Achim. :-) > On 2020-11-04, at 20:05, Achim Zeileis wrote: > > EXTERNAL EMAIL: Treat content

Re: [R] newdata for predict.lm() ??

2020-11-04 Thread Achim Zeileis
On Wed, 4 Nov 2020, peter dalgaard wrote: Don't use $ notation in lm() formulas. Use lm(w ~ h, data=DAT). ...or in any other formula for that matter! Let me expand a bit on Peter's comment because this is really a pet peeve of mine: The idea is that the formula "w ~ h" described the

Re: [R] newdata for predict.lm() ??

2020-11-04 Thread peter dalgaard
Don't use $ notation in lm() formulas. Use lm(w ~ h, data=DAT). -pd > On 4 Nov 2020, at 10:50 , Boris Steipe wrote: > > Can't get data from a data frame into predict() without a detour that seems > quite unnecessary ... > > Reprex: > > # Data frame with simulated data in columns "h"

[R] newdata for predict.lm() ??

2020-11-04 Thread Boris Steipe
Can't get data from a data frame into predict() without a detour that seems quite unnecessary ... Reprex: # Data frame with simulated data in columns "h" (independent) and "w" (dependent) DAT <- structure(list(h = c(2.174, 2.092, 2.059, 1.952, 2.216, 2.118, 1.755,