Reputation: 19
1)I tried the below function but got an error message below. could you please let me know what I did wrong with the commands?
#function:
sleep<-sleep
lm1<-lm(extra~group, sleep)
coef(lm(sleep$extra~sleep$group))
Error message:
Error in eval(predvars, data, env) :
argument "y" is missing, with no default
2)To understand the coef()
function, I tried the example below provided by help. The weird thing is it was running without a problem, but after I got the error message above, when I re-ran the example again, it gave me the same error message.
x <- 1:5
coef(lm(c(1:3, 7, 6) ~ x))
Hope anybody can help me with this.
Upvotes: 0
Views: 268
Reputation: 3183
You already saved the linear model in lm1
Try coef on that
coef(lm1)
Upvotes: 1