title: How to compute rowSums in rcpp
body: <p>I'm converting an <em>R</em> function into Rcpp, where I have used the R function <code>rowSums</code>, which appears to not be a valid sugar expression in Rcpp. I found code for an Rcpp version of rowSums <a href="http://adv-r.had.co.nz/Rcpp.html" rel="noreferrer">here</a>. But I'm getting </p>
  
  <blockquote>
    <p>error: use of undeclared identifier</p>
  </blockquote>
  
  <p>when I use <code>rowSumsC()</code> in my main Rcpp function. </p>
  
  <p>Is there a easy fix?</p>
  
  <p>Edit: The code</p>
  
  <pre><code>cppFunction(
    "NumericMatrix Expcpp(NumericVector x, NumericMatrix w,
     NumericVector mu, NumericVector var, NumericVector prob, int k) {
     for (int i=1; i&lt;k; ++i){
     w(_,i) = prob[i] * dnorm(x,mu[i], sqrt(var[i]));
     }
     w = w / rowSums(w)
     return w;
  }")
  </code></pre>