I currently have a program that automates 2-way ANOVA on a series of endpoints, 
but before the ANOVA is carried out I want the code to test the assumptions of 
normality and equal variance and report along with each anova result in the 
output file.  How can I do this? 


I have pasted below the code that I currently use. 

 
library(car)
numFiles = x # <--<--<--<--<--<--<--<--<--<--<-- supply the number of files 
containing the source data here
for (iIndx in 1:numFiles) {
       sinkFilePath = paste("C:/AnovaData/2WayAnovaForProteins_Set", iIndx, 
".txt", sep="")
 sink(sinkFilePath)
 sourceFilePath = paste("C:/AnovaData/ProteinsFor2WayAnova_Set", iIndx, ".txt", 
sep="")
 dataSet = read.delim(sourceFilePath)  
 numProteins = ncol(dataSet)
 nameProteins = colnames(dataSet)
 for (i in 3:numProteins) {
  fla = as.formula(paste(nameProteins[i],"~","Trt*Dose"))
  mod = lm(fla, data = dataSet , contrasts = list(Trt = contr.sum, Dose = 
contr.sum))
  ano = Anova(mod, type = "III")
  print.noquote("")
  print.noquote("")
  print.noquote("--------------------------------------------")
  print.noquote(paste("--------- Analysis of Spot: 
",nameProteins[i],"------------"))
  print.noquote("--------------------------------------------")
  print(ano)
 }
}


Thanks in advance.
Karthi


	[[alternative HTML version deleted]]

