When should I use a t-test versus an ANOVA? I have data of bacterial abundances in different treatments (triplicates).  The treatments test 3 factors: Location (root/soil), Fungi (added/none), and Insect (added/none).
I would like to determine which bacterial abundances significantly change upon the addition of Fungi, irrespective of the presence of the insect.
I first performed ANOVA (for the root and soil subsets separately):
aov(df[,i]~df$Fungi*df$Insect) with i being the bacterial abundances
Then I performed t-tests:
t.test(df_Fungi,df_noFungi)
The results 'mostly' agree with each other, but  some bacterial changes are significant with the ANOVA and not the t-tests.
Is one of these approaches more 'correct' than the other?
 A: The most significant (so to speak) difference between them is that the t-test is to test whether two groups of samples belongs to the same population (that is whether they might be identically distributed). It does this by checking the ratio between the differences in the means and standard deviations.
However, if you have more than two, ANOVA is (usually*) the way to go.  the The paired t-test is based on the fact that $t^2=f$, and ANOVA also uses the $f$isher distribution in a generalized way, such that it generalizes almost nicely$^!$. In other words when plain (one-way) ANOVA is used for only two populations, then they should be identical, since  
Moreover, you can do a two-way ANOVA, and apply stuff like randomized block design and so fort.
However, here by doing the multiplication sign, you're doing interaction between the factors. That is actually a two-way ANOVA.
aov(df[,i]~df$Fungi*df$Insect)

is identical to
aov(df[,i]~df$Fungi+df$Insect+df$Fungi:df$Insect)

where df$Fungi:df$Insect denotes the interaction between those two variables. However, if you replace it with 
    aov(df[,i]~df$Fungi+df$Insect)
(note the + instead of *) I'm fairly certain you should get the same results as the t.test.
*: There are of course other tests, like a multiple t$^2$-test.
A: A t-test is just a special case of the ANOVA when you have only a single independent variable that has only two groups (e.g., you are simply comparing two means). In this case $t^2 = F$. You have run to different models. You ANOVA is a two-way ANOVA (2 by 2), testing both the main effects of Fungi and Insect and the interaction of the two. What happened to Location? Shouldn't it be in the model as well? The t-test test the mean difference for Fungi but if insect or location are unbalanced between the two groups, then this could be biased. Your question implies that you want to test Fungi, holding insect constant. Thus, an ANOVA without interaction with all three factors (Fungi, Insect, and Location) would be most appropriate. The effect you are interested in is the main effect for Fungi. Assuming Insect and Location have an effect on the DV, this test will also have more power (well, assuming the effect is large enough to offset the cost in dfs).
