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