Hello all,<br><br>Still taking my first steps, I&#39;ve come across a feature (?) I cannot yet make sense of. Consider a simple function with its argument passed by value:<br><br>SEXP fun(SEXP arg)<br>{<br><div style="margin-left: 40px;">

using namespace Rcpp;<br><br>NumericVector vec(arg);<br>for(int i=0; i&lt;vec.size(); i++)<br>vec[i] += 1;<br><br>return vec;<br></div>}<br><br>The call in R is declared as<br><br>R.fun &lt;- function(arg)<br>{<br><div style="margin-left: 40px;">

.Call( &quot;fun&quot;, as.double(arg), PACKAGE = &quot;wonderland&quot; )<br></div>}<br><br><br>Using Rcpp 0.8.6 and R-2.11.1, I get<br><br>&gt; arg &lt;- 1:2 # or any vector of size &gt; 1<br>&gt; result &lt;- R.fun(arg)<br>

&gt; result; arg<br>[1] 2 3<br>[1] 1 2<br><br>That&#39;s fine -- but if I take as argument a vector of size 1, I get<br><br>&gt; arg &lt;- 1<br>&gt; result &lt;- R.fun(arg)<br>&gt; result; arg<br>[1] 2<br>[1] 2<br><br>What am I missing?<br>

Thanks, Jo<br><br>