我有一个列联表I‘我喜欢
0 1 10 11 12 13 14 2 3 4 5 6 7 8
3780 3502 433 316 284 168 74 2104 1930 1560 1482 868 691 645 575
当我做名字(T)时,我得到
1 "0“"1”"10“"11”"12“"13”"14“"2”"3“"4”"5“"6”"7“"8”"9“
这意味着行的名称是整数串。我想对表进行排序,使其顺序为0,1,2,3,..etc。我该怎么做呢。我尝试了order(名称(T)),但没有给出所需的输出。
发布于 2019-04-06 00:00:38
我们可以在转换为numeric的names上使用order
t1 <- t[order(as.integer(names(t)))]https://stackoverflow.com/questions/55539357
复制相似问题