title: ggplot and pivot_longer on multiple factors
body: <p>I want to make my data frame longer, so I can make a plot out of it. I have a dichotomous variable (sex) by which I want to sort. And I have four exposures as factors. </p>
  
  <pre><code>  DF &lt;- data.frame(sex = rbinom(1000, 1, .5),
                                  expo_1 = rbinom(1000, 1:4, .15),
                                  expo_2 = rbinom(1000, 1:4, .25),
                                  expo_3 = rbinom(1000, 1:4, .3),
                                  expo_4 = rbinom(1000, 1:4, .45))                                                   
    DF$sex &lt;- as.factor(sex)
    DF$expo_1 &lt;- as.factor(expo_1)
    DF$expo_2 &lt;- as.factor(expo_2)
    DF$expo_3 &lt;- as.factor(expo_3)
    DF$expo_4 &lt;- as.factor(expo_4)
  </code></pre>
  
  <p>This is as far as I got. I'm struggling to get a count for each level of an expo.</p>
  
  <pre><code>DF %&gt;%
    pivot_longer(cols = -sex, names_to = "expo") %&gt;%
    group_by(sex, expo) 
  </code></pre>
  
  <p>And I would like to have something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/dxNU3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dxNU3.png" alt="enter image description here"></a></p>
  
  <p>Help is much appreciated and thanks in advance!</p>