Re: [Rd] Understanding modification in place

2013-07-25 Thread Hadley Wickham
>> If I run it from the command line, I get: >> >> Global >> @1050bb840 13 INTSXP g0c2 [MARK,NAM(1)] (len=3, tl=0) 1,2,3 >> @1050bb840 13 INTSXP g0c2 [MARK,NAM(1)] (len=3, tl=0) 1,1,3 >> In function >> @1050bb190 13 INTSXP g0c2 [NAM(1)] (len=3, tl=0) 1,2,3 >> @1050bb190 13 INTSXP g0c2 [NAM(1)] (len

Re: [Rd] Understanding modification in place

2013-07-24 Thread Simon Urbanek
On Jul 24, 2013, at 10:35 AM, Hadley Wickham wrote: > Hi all, > > Take this simple script, which I'm trying to use to understand when > modification in-place occurs, and when a new object is created: > > message("Global") > x <- 1:3 > .Internal(inspect(x)) > x[2] <- 1L > .Internal(inspect(x)) >

[Rd] Understanding modification in place

2013-07-24 Thread Hadley Wickham
Hi all, Take this simple script, which I'm trying to use to understand when modification in-place occurs, and when a new object is created: message("Global") x <- 1:3 .Internal(inspect(x)) x[2] <- 1L .Internal(inspect(x)) message("In function") (function() { x <- 1:3 .Internal(inspect(x))