title: Sum selected rows to a new row in R
body: <p>I have to add a new row <code>total</code> in a dataframe where I am trying to add the values for that row which has value like <code>Mazda</code>.Below is the df I am using.</p>
  
  <pre><code>df &lt;- data.frame(month = c("mazda 3", "mazda cx5", "mazda 6","mazda miata","honda civic","honda accord"),
               april = c(.1,.2,.3,.3,.4,.5),
               may = c(.3,.4,.5,.2,.1,.5),
               june = c(.2,.1,.5,.1,.2,.3))
  
  
  d2&lt;- df %&gt;% mutate(total == (rowsum(df[-1], df[rownames(month) %like% "Mazda"])))
  </code></pre>
  
  <p>Output should be :</p>
  
  <pre><code>df_out &lt;- data.frame(month = c("mazda 3", "mazda cx5", "mazda 6","mazda miata","honda civic","honda accord","total_mazda"),
                   april = c(.1,.2,.3,.3,.4,.5,.8),
                   may = c(.3,.4,.5,.2,.1,.5,1.4),
                   june = c(.2,.1,.5,.1,.2,.3,.9))
  </code></pre>