Interaction between two categorical variables in R
<p>We are dealing with a regression model that contains two categorical variables age groups and gender.</p>

<p>We want to include an interaction term between the two categorical variables but the resulting model only displays the effects of the interactions between females with all age groups.</p>

<p>How can we adjust the code so that it keeps "males" aged "26-30" as a reference level and shows the effect of all other groups in its output?</p>

<p><em>Adjustment code</em></p>

<pre><code>count_med_op3 &lt;- glm(Count_OP ~ Gender * age_group + otherfactors,
                     data = med, family = 'poisson')
</code></pre>

<p>Result wanted for:</p>

<pre><code>GenderMale:age_group"0-1" 
GenderMale:age_group"2-6"
GenderMale:age_group"7-18"
GenderMale:age_group"19-25"
GenderMale:age_group"31-36"
Genderfemale:age_group"0-1"
Genderfemale:age_group"2-6"
Genderfemale:age_group"7-18"
Genderfemale:age_group"19-25"
Genderfemale:age_group"26-30"
other factors
</code></pre>