Open jembrown opened 5 years ago
I'm following up on this, because I just ran into it again. In this case, I was trying to sort a vector, reassign the sorted vector to the original variable name, and access individual elements in the sorted vector. This works properly when the vector is defined all at once. But it fails when the vector is created by assigning to individual indices.
> myVec <- [1.2,6.7,4.5]
> myVec
[ 1.200, 6.700, 4.500 ]
> myVec <- sort(myVec)
> myVec
[ 1.200, 4.500, 6.700 ]
> myVec[2]
4.5
> myVec[3]
6.7
> myVecTwo[1] <- 1.2
> myVecTwo[2] <- 6.7
> myVecTwo[3] <- 4.5
> myVecTwo
[ 1.200, 6.700, 4.500 ]
> myVecTwo <- sort(myVecTwo)
> myVecTwo
[ 1.200, 4.500, 6.700 ]
> myVecTwo[2]
6.7
Something about the way vectors and vector elements are created and/or assigned leads to a bug when reassigning a vector to a variable name. In this example,
testVec[1]
should be0
at the end.