title: Dividing columns by particular values using dplyr
body: <p>I have a dataframe like this:</p>
  
  <pre><code> Setting   q02_id c_school c_home c_work c_transport c_leisure Country
     Rural 11900006        0      5      3           1         1 Vietnam
     Rural 11900031       10      5      0           0         0 China
     Rural 11900033        0      3      0           0         3 Vietnam
     Rural 11900053        0      7      2           0         0 Vietnam
     Rural 11900114        3      6      0           0         0 Malaysia
     Rural 11900446        0      6      0           0         0 Vietnam
  </code></pre>
  
  <p>and I would like to divide columns 2, 3, 4, 5, 6 by the total for that particular country.</p>
  
  <p>Doing it in base R is a bit clumsy:</p>
  
  <pre><code>df[df$Country=="Vietnam",][c(3, 4, 5, 6)] = df[df$Country=="Vietnam",][c(3, 4, 5, 6)] / sum(df[df$Country=="Vietnam",][c(3, 4, 5, 6)])
  </code></pre>
  
  <p>(I think that works).</p>
  
  <p>I'm trying to convert as much of my code as possible to use tidyverse functions. Is there a way of doing the same thing more efficiently using, <code>dplyr</code>, for instance?</p>
  
  <p>Thanks.</p>