Re: [Rd] Possibility for memory improvement: x - as.vector(x) always(?) duplicates

2010-11-29 Thread Henrik Bengtsson
FYI, from the recent R devel NEWS file: as.vector() and as.double() etc duplicate less when they leave the mode unchanged but remove attributes. as.vector(mode = any) no longer duplicates when it does not remove attributes. This helps memory usage in matrix() and array(). This improvement will

[Rd] Possibility for memory improvement: x - as.vector(x) always(?) duplicates

2010-11-23 Thread Henrik Bengtsson
Hi, I've noticed that as.vector() always allocates a new object, e.g. x - 1:10; x - as.vector(x); tracemem(x); [1] 0x05622db8 x - as.vector(x); tracemem[0x05622db8 - 0x05622ec0]: as.vector x - as.vector(x); tracemem[0x05622ec0 - 0x05622f18]: as.vector