Function `[<-` will _replace_ an element, but not append an _element_
问题 I noticed the following when using '[<-' . I am successful at replacing elements but not at appending an element to the vector. Example: VarX <- integer() VarX[1] <- 11 `[<-`(VarX, 2, 22) VarX # [1] 11 # Expected the value of VarX to be: # [1] 11 22 # Also tried: `[<-`(VarX, i=2, value=22) VarX # [1] 11 However, if there is already a value at the index, the value does get replaced. VarX <- integer() VarX[1] <- 11 VarX[2] <- 99 VarX # [1] 11 99 `[<-`(VarX, 2, 22) VarX # [1] 11 22 Do I simply