C(object, contr, how.many)
Note that setting how.many to be less than k-1 in a model formula is an assertion that the coefficients for the remaining factors are either known to be negligible or else should be aliased with other coefficients. The wafer example below is an example of aliasing the remaining contrasts.
# use treatment contrasts for factor Cat aov(Yield ~ Cont* C(Cat, treatment), catalyst)# only fit linear and quadratic effects aov(Defects ~ C(Reliability, poly, 2) * Type * Plant)
# partition spinsp into linear effect (the term with C) and # the higher order contrasts (the term with spinsp) # note that the order of the terms is important attach(wafer) aov(pre.mean ~ C(spinsp, poly, 1) + spinsp)