<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div>.</div><div>.</div><div>.</div><div><br></div><div>&gt; You also nmeed to disentangle the assignment as there is too much template</div><div>&gt; magic. &nbsp;So this just worked for me:</div><div>&gt;&nbsp;</div><div>&gt;&nbsp;</div><div>&gt; R&gt; library(Rcpp)</div><div>&gt; R&gt; library(inline)</div><div>&gt; R&gt;&nbsp;</div><div>&gt; R&gt; xorig &lt;- c(1, -2, 3, -4, 5, -6, 7)</div><div>&gt; R&gt;&nbsp;</div><div>&gt; R&gt; code &lt;- '</div><div>&gt; + &nbsp; &nbsp;NumericVector x(xs);</div><div>&gt; + &nbsp; &nbsp;NumericVector xa = sapply( x, ::fabs );</div><div>&gt; + &nbsp; &nbsp;return(xa);</div><div>&gt; + &nbsp; &nbsp;'</div><div>&gt; R&gt;&nbsp;</div><div>&gt; R&gt; xabs &lt;- cxxfunction(signature(xs="numeric"),</div><div>&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp;plugin="Rcpp",</div><div>&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;body=code)</div><div>&gt; R&gt;&nbsp;</div><div>&gt; R&gt; xabs(xorig)</div><div>&gt; [1] 1 2 3 4 5 6 7</div><div>&gt; R&gt;&nbsp;</div><div>.</div><div>.</div><div>.</div><div><br></div><div>That works perfectly. &nbsp;Thanks, Dirk.</div><div><br></div><div>-- Mike</div><div style="font-size: 12pt; "><br></div></div></body></html>