按下标批量索引,并重新排序
x<-c(11,22,33,44,55,66,77)
myorder<-c(2,4,3)
x[myorder]
[1] 22 44 33```
###也可以重复提取
myorder<-c(2,2,5,5,7)
x[myorder]
[1] 22 22 55 55 77```
去掉某个元素
> x[-2]
[1] 11 33 44 55 66 77
> x[c(-2,-4,-5)]
[1] 11 33 66 77
使用length去掉最后一个元素
x[-length(x)]