I am setting up a vector data, and want to extract a part of it.
I tried two methods, as shown below. I thought these should have the same output, but results are different. Why?
data1<- c( 1, 2, 3, 4, 5 )
data1[ length( data1 ) - 2 : length( data1 ) ]
# ; [1] 3 2 1
data1[ 3 : 5 ]
# ; 3 4 5