Skip to content
Prev 32856 / 63421 Next

reference counting bug: overwriting for loop 'seq' variable

William Dunlap wrote:
indeed;  seems like you've hit the issue of when r triggers data
duplication and when it doesn't, discussed some time ago in the context
of names() etc.  consider:

    x = 1:2
    for (i in x)
       x[i+1] = i-1
    x
    # 1 0 1

    y = c(1, 2)
    for (i in y)
       y[i+1] = i-1
    y
    # -1 0


vQ