Using R formulae to test for main effects in the presence of   higher-order interactions
  Traditional analysis of variance (ANOVA) software allows researchers to test for the significance of main effects in the presence of interactions without exposure to the details of how the software encodes main effects and interactions to make these tests possible. Now that increasing numbers of researchers are using more general regression software, including mixed-effects models, to supplant the traditional uses of ANOVA software, conducting such tests generally requires greater knowledge of how to parameterize one's statistical models appropriately. Here I present information on how to conduct such tests using R, including relevant background information and worked examples. 
Roger Levy
stat.ME