# Paired t-test with subsamples in R?

I've been trying to find a similar "problem", but I didn't, so I'm going to try to explain what am I looking for.

I have for different sites A,B,C and D. In each site I have a forest and a fallow=> AFo, AFa, BFo,BFa... In each forest and fallow I have 4 quadrates: AFo1, AFo2, AFo3, AFo4, AFa1,...

I measured different variables such as pH, electric conductivity, total phosphorus, etc in all quadrates. My aim is to compare the forests to the fallows, but I have to take into account the variability between the sites and the quadrates.

I have made a two way crossed ANOVA, but my teacher told me that I should do a t-test which takes into account the subsamples (the quadrates). My fixed factor would be forest/fallow, and my random factor the sites.

Can anyone help me, please? :)

Thank you very much in advance!

Lili

More or less, but normally she wants me to perform a t-test on all the AFo-s , while taking into account the subsamples 1,2,3 and 4.

Because what I would like to do is not to compare the quadrate1 from the forest with quadrate 1 from the fallow, but the mean of the 4 quadrates of the forest with the mean of the 4 quadrates of the fallow. Hm. don't know whether I'm expressing myself clearly..

$$\left[ \begin{array}{cc} AFo1 & AFa1 \\ AFo2 & AFa2 \\ \vdots & \vdots \\ DFo4 & DFa4 \end{array} \right]$$