From therneau at mayo.edu  Mon Oct  3 20:43:49 2011
From: therneau at mayo.edu (Terry Therneau)
Date: Mon, 03 Oct 2011 13:43:49 -0500
Subject: [Rd] number of copies
In-Reply-To: <873E1DFD-610E-4683-8633-78FC55507A62@r-project.org>
References: <1317652357.979.25.camel@nemo>
	<7182A7C5-0FAC-423D-8B97-B84DCD623408@r-project.org>
	<1317658585.979.48.camel@nemo>
	<873E1DFD-610E-4683-8633-78FC55507A62@r-project.org>
Message-ID: <1317667429.979.55.camel@nemo>


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.



[Rd] number of copies
Terry Therneau