<div dir="ltr"><span style="font-size:12.8000001907349px">I attempted to implement the call by reference example on page 200 of Seamless R and C++, as follows:</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div>#include <Rcpp.h></div><div>using namespace Rcpp;</div><div><br></div><div>// [[Rcpp::export]]</div><div>void absC(double & x) {</div><div><span style="white-space:pre-wrap">     </span>if (x < 0) x = -x;</div><div>}</div><div><br></div><div>/*** R</div><div>x = -1</div><div>absC(x)</div><div>x</div><div>*/</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Unfortunately, x remains equal to -1.</div><div style="font-size:12.8000001907349px">Platforms: Windows 7,  "R version 3.1.3 Patched (2015-03-16 r68103)".</div><div style="font-size:12.8000001907349px">Please advise.</div></div>