Skip to content
Prev 69210 / 398506 Next

Using add1() as the FUN argument to by()

Why does the following not work?

by(warpbreaks, warpbreaks$tension, function(x) add1(lm(breaks ~ 1, 
data=x), ~ . + wool))

Error in inherits(x, "data.frame") : Object "x" not found

Is there another efficient way to apply add1() to subsets of a data frame?

Thanks.