Surely it is possible but without more detail of your question and about input/output format it is difficult to give a definitive answer. This is a very crude way to address your problem. If your dependent variables are in a list you could loop thorough that list:
Sample data:
age<- 1:10
diet<- factor(c('A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B'))
dependent_vars<- list(
y1= rnorm(n= 10),
y2= rnorm(n= 10),
y3= rnorm(n= 10)
## Etc... till 183
)
## Loop through list:
for(y in names(dependent_vars)){
ymod<- summary(aov(dependent_vars[[y]] ~ age * diet))
cat(paste('\nDependent var:', y, '\n'))
print(ymod)
}
Output:
Dependent var: y1
Df Sum Sq Mean Sq F value Pr(>F)
age 1 0.858 0.858 0.456 0.525
diet 1 4.310 4.310 2.291 0.181
age:diet 1 0.002 0.002 0.001 0.978
Residuals 6 11.289 1.881
Dependent var: y2
Df Sum Sq Mean Sq F value Pr(>F)
age 1 0.209 0.2088 0.278 0.617
diet 1 0.449 0.4486 0.598 0.469
age:diet 1 0.015 0.0145 0.019 0.894
Residuals 6 4.500 0.7501
Dependent var: y3
Df Sum Sq Mean Sq F value Pr(>F)
age 1 0.005 0.0046 0.003 0.956
diet 1 0.442 0.4424 0.319 0.593
age:diet 1 0.258 0.2576 0.186 0.681
Residuals 6 8.315 1.3859
The output of the anova goes to standard output, so it might not be very useful. Most important: Make sure it does what you need!
Thank you very much for your answer.
The data are arranged like this for the first metabolite (Ala):
I am not sure if I would have to arrange the data like this for the remaining (Arg, Asn, Asp, Cit, ..until the 184). That would be nice if R could do the two way anova, but I am not really sure how.
Thank you for your suggestions.