R sorts a vector on its own accord

后端 未结 4 918
误落风尘
误落风尘 2021-01-01 21:45
df.sorted <- c(\"binned_walker1_1.grd\", \"binned_walker1_2.grd\", \"binned_walker1_3.grd\",
    \"binned_walker1_4.grd\", \"binned_walker1_5.grd\", \"binned_walk         


        
4条回答
  •  梦毁少年i
    2021-01-01 22:42

    Isn't this simply the same thing you get with all lexicographic shorts (as e.g. ls on directories) where walker10_foo sorts higher than walker1_foo?

    The easiest way around, in my book, is to use a consistent number of digits, i.e. I would change to binned_walker01_1.grd and so on inserting a 0 for the one-digit counts.

提交回复
热议问题