Message-ID: <BA1B8718-4D98-4C04-8D40-E409D1A774E0@r-project.org>
Date: 2012-11-10T01:59:46Z
From: Simon Urbanek
Subject: built-in NAMED(obj) from within R
In-Reply-To: <CABdHhvFMGGU_jFSeYq8i4C1vH9=poJ21PJv1eO=S0wFm76e=uQ@mail.gmail.com>
On Nov 9, 2012, at 8:00 AM, Hadley Wickham wrote:
>>> The goal is to ascertain whether a copy of an object has been made.
>>
>> Then :
>>
>> ?tracemem
>>
>> One demonstration of using both together is here :
>>
>> http://stackoverflow.com/a/10312843/403310
>
> Note that tracemem detects duplications (in a technical R sense), not
> copies - i.e.
>
> x <- 1:10
> tracemem(x)
> x[11] <- 11L
>
> although all the individual elements are copied,
No elements are copied - this is a subassignment and it is done in place hence there is neither duplication nor copying - simply the value of the 11th element is changed.
> the vector is not duplicated. This confused me at first, so I thought I'd point it out.
>
I'm not quite sure what is your distinction you are trying to make there...
Cheers,
Simon
> Hadley
>
> --
> RStudio / Rice University
> http://had.co.nz/
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>