I'm looking at whether the intake rate of a monkey eating leaves changes from the first quarter of time spent in a tree to the last quarter.
I've analysed this generally, but now I want to stratify by food type, to see if the food type leads to a significant change.
Here is a sample of my data:
Intake.Q1 | Intake.Q4 | FOOD.TYPE |
---|---|---|
6 | 6 | M |
19.5 | 5 | M |
5.1 | 2.5 | M |
4.8 | 2.1 | Y |
10.6 | 5.4 | Y |
6 | 2.5 | Y |
This is the code I used to generally do a t-test on all data, regardless of food type.
t.test(R_DATA$Intake.Q1,R_DATA$Intake.Q4)
What would I add to this code in order to stratify based on 'M' and 'Y', so I can see whether there was a significant change in intake rate between Q1 and Q4 when eating Mature leaves, and the same for Young leaves?