Build a Quick Function

anova.post=function(model)
{   
  mod=aov(model)
  sum=summary(mod)
  posthoc=TukeyHSD(mod)
  layout(matrix(c(1,2,3,4),2,2))
  plot=plot(mod)
  
  #non-parametric conclusion
  kw=kruskal.test(model)
  mylist=list(mod,sum,posthoc,plot,kw)
  return(mylist)
}

Pass the Model to the Function

model=airquality$Ozone~as.factor(airquality$Month)
anova.post(model)

## [[1]]
## Call:
##    aov(formula = model)
## 
## Terms:
##                 as.factor(airquality$Month) Residuals
## Sum of Squares                     29437.90  95705.16
## Deg. of Freedom                           4       111
## 
## Residual standard error: 29.36339
## Estimated effects may be unbalanced
## 37 observations deleted due to missingness
## 
## [[2]]
##                              Df Sum Sq Mean Sq F value   Pr(>F)    
## as.factor(airquality$Month)   4  29438    7359   8.536 4.83e-06 ***
## Residuals                   111  95705     862                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 37 observations deleted due to missingness
## 
## [[3]]
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = model)
## 
## $`as.factor(airquality$Month)`
##            diff         lwr       upr     p adj
## 6-5   5.8290598 -25.6630930 37.321213 0.9858842
## 7-5  35.5000000  12.9158068 58.084193 0.0002795
## 8-5  36.3461538  13.7619606 58.930347 0.0001869
## 9-5   7.8328912 -14.1594735 29.825256 0.8603562
## 7-6  29.6709402  -1.8212127 61.163093 0.0749128
## 8-6  30.5170940  -0.9750588 62.009247 0.0622826
## 9-6   2.0038314 -29.0666371 33.074300 0.9997676
## 8-7   0.8461538 -21.7380394 23.430347 0.9999733
## 9-7 -27.6671088 -49.6594735 -5.674744 0.0061535
## 9-8 -28.5132626 -50.5056273 -6.520898 0.0043387
## 
## 
## [[4]]
## NULL
## 
## [[5]]
## 
##  Kruskal-Wallis rank sum test
## 
## data:  airquality$Ozone by as.factor(airquality$Month)
## Kruskal-Wallis chi-squared = 29.267, df = 4, p-value = 6.901e-06