[R] Is there lazy copy in R?

Peng Yu pengyu.ut at gmail.com
Tue Dec 15 05:15:10 CET 2009


> a=1:10
> b=a
> a=1:10
> tracemem(a)# I assume the following is address 'a' points to
[1] "<0x05cf2798>"
> b=a
> b[1]=1
tracemem[0x05cf2798 -> 0x05cf2750]:
tracemem[0x05cf2750 -> 0x05ed8ba0]:

I don't understand what these addresses mean. Would you please help me
understand it?

On Mon, Dec 14, 2009 at 9:23 PM, Benilton Carvalho <bcarvalh at jhsph.edu> wrote:
> use tracemem() to figure out... and read its documentation in detail.
> b
>
>
> On Dec 15, 2009, at 1:03 AM, Peng Yu wrote:
>
>> I'm wondering if lazy copy is available in R or not. For example, in
>> the following code, I'm wondering if the memory for y is allocated in
>> the 2nd line or the 3rd line. Is there a documentation for this?
>>
>> x=1:10000
>> y=x
>> y[[10]]=5
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>




More information about the R-help mailing list