[R] Using add1() as the FUN argument to by()

Chuck Cleland ccleland at optonline.net
Thu May 5 18:54:23 CEST 2005

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?


Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

More information about the R-help mailing list