在
mv
z
mv_sorted
mv <- c('w','t','z','f') mv_sorted <- c('z','w','t','f')
尝试
order
> mv[order(mv != "z")] [1] "z" "w" "t" "f" > mv[order(mv == "z", decreasing = TRUE)] [1] "z" "w" "t" "f"