I have the following type of dataset:

<pre>
        |          |             |            variable_r         |
subject |  gender  |  age_group  |     Cond_1    |     Cond_2    |
--------|----------|-------------|---------------|---------------|
   1    |    m     |      1      | r (A) | r (B) | r (A) | r (B) |
   2    |    f     |      2      | r (A) | r (B) | r (A) | r (B) |
...
   8    |    f     |      2      | r (A) | r (B) | r (A) | r (B) |
</pre>

So two genders, two age groups, two conditions (Cond_1 and Cond_2) under which the experiment was done and two ways the subjects were prompted (A and B). r is the numerical result from each experiment. So two within-subject variables (prompt A/B and Cond 1/2) and two between-subject variables (age group 1/2 and gender m/f) (right?). I should calculate the statistically significant effects of each variable and their interactions.

How can I do this in R (or Python)? My googling found a lot of information about different types of ANOVA analyses, but I wasn't able to apply that information to my case.

Thanks!

e: the subjects were tested 4 times