[R] Overlapping assignment

Rob Steele rfin.20.phftt at xoxy.net
Tue Apr 25 04:32:02 CEST 2006


Is it valid to assign a slice of an array or vector to an overlapping 
slice of the same object?  R seems to do the right thing but I can't 
find anything where it promises to.

 > a <- 1:12
 > a[4:12] <- a[1:9]
 > a
  [1] 1 2 3 1 2 3 4 5 6 7 8 9

 > b <- 1:12
 > b[1:9] <- b[4:12]
 > b
  [1]  4  5  6  7  8  9 10 11 12 10 11 12




More information about the R-help mailing list