ANOVA for many variables using loops or apply


I think I have a simple question, but can't seem to find a good answer and would appreciate any help! I have no previous experience with R or any programming language so thanks for your patience.

I am running ANOVA with Tukey's post-hoc for several sets of data and variables (plant data), about 25 variables in total. I have the data in Excel files, with the dependent variables in the first columns and then my independent variables (Treatment+Batch) at the end.

I want to run the following for all variables:

  1. Fit linear model
  2. Print/output a histrogram and normality (Q-Q) plots
  3. Perform ANOVA
  4. Perform Tukey's
  5. Print summary of ANOVA and Tukey's
  6. Print/output boxplot of Tukey's groups (with ggplot2)

Is there a simple for loop, or s/l apply chunk to take care of all this?

It seems like a standard thing to do in R, with standard outputs, but I can't seem to find exactly the answer I'm looking for.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.