title: Passing mean and standard deviation into dnorm() using Rcpp Sugar
body: <p>I am converting some R code to Rcpp code and need to calculate the likelihood for a vector of observations given a vector of means and vector of standard deviations.  If I assume the means are 0 and the standard deviations 1, I can write this function (running this requires the 'inline' and 'Rcpp' packages to be loaded), </p>
  
  <pre><code>dtest1 = cxxfunction(signature( x = "numeric"),
                        'Rcpp::NumericVector xx(x);
                         return::wrap(dnorm(xx, 0.0, 1.0));', 
                         plugin='Rcpp')
  </code></pre>
  
  <p>and the result is as expected. </p>
  
  <pre><code>&gt; dtest1(1:3) 
  [1] 0.241970725 0.053990967 0.004431848
  </code></pre>
  
  <p>However, if I try to make a function</p>
  
  <pre><code>dtest2 = cxxfunction(signature( x = "numeric", y="numeric", z="numeric" ),
                    'Rcpp::NumericVector xx(x);
                     Rcpp::NumericVector yy(y);
                     Rcpp::NumericVector zz(z);
                     return::wrap(dnorm(xx, yy, zz));',
                     plugin='Rcpp')
  </code></pre>
  
  <p>which would allow me to pass in different means and standard deviations results in an error, shown below.  Is there a way to make the function I am trying to make, or I do need to program the normal density manually?</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>Error in compileCode(f, code, language = language, verbose = verbose) :   
      Compilation ERROR, function(s)/method(s) not created! file31c82bff9d7c.cpp: In function ‘SEXPREC* file31c82bff9d7c(SEXP, SEXP, SEXP)’:
  file31c82bff9d7c.cpp:33:53: error: no matching function for call to 
       ‘dnorm4(Rcpp::NumericVector&amp;, Rcpp::NumericVector&amp;, Rcpp::NumericVector&amp;)’
  file31c82bff9d7c.cpp:33:53: note: candidates are:
  /home/chris/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include/Rcpp/stats/norm.h:106:1: 
       note: template&lt;int RTYPE, bool NA, class T&gt; Rcpp::stats::D0&lt;RTYPE, NA, T&gt; Rcpp::dnorm4(const Rcpp::VectorBase&lt;RTYPE, NA, VECTOR&gt;&amp;, bool)
  /home/chris/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include/Rcpp/stats/norm.h:107:1: 
       note: template&lt;int RTYPE, bool NA, class T&gt; Rcpp::stats::D1&lt;RTYPE, NA, T&gt; Rcpp::dnorm4(const Rcpp::VectorBase&lt;RTYPE, NA, VECTOR&gt;&amp;, double, bool)
  /home/chris/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include/Rcpp/stats/norm.h:108:1: 
       note: template&lt;int RTYPE, bool NA, class T&gt; Rcpp::stats::D2&lt;RTYPE, NA, T&gt; Rcpp::dnorm4(const Rcpp::VectorBase&lt;RTYPE, NA,
  In addition: Warning message:
  running command '/usr/lib/R/bin/R CMD SHLIB file31c82bff9d7c.cpp 2&gt; file31c82bff9d7c.cpp.err.txt' had status 1
  </code></pre>