Skip to content

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

1 message · Chuck Cleland

#
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.