[Rd] number of copies

Terry Therneau therneau at mayo.edu
Mon Oct 3 20:43:49 CEST 2011

On Mon, 2011-10-03 at 12:31 -0400, Simon Urbanek wrote:
> > Thanks.  I was hoping that x[,sorted] would act like "double(n)"
> does in a .C call, and have no extra copies made since it has no local
> assignment.
> Yes it does act the same way, you get an extra copy with double(n) as
> well - there is no difference.

That is surprising.  This is not true of Splus.  Since Chambers mentions
it as a specific case as well (Programming with Data, p421) I assumed
that R would be at least as intellegent.  He also used the unset()
function to declare that something could be treated like double(n),
i.e., need no further copies. But that always looked like a dangerous
assertion to me and unset has disappeared, perhaps deservedly, from R.

Terry T.

More information about the R-devel mailing list