Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在 R 中加载了几列的文件。我想要实现的是根据每个列中的最小值对文件的列进行排序。例如
输入(minA=0,minB=3,minC=1) ABC 4 8 1 2 3 4 0 3 1
输出 ABC 4 1 8 2 4 3 0 1 3
你可以apply()这样试试:
apply()
mins <- apply(myData, 2, min) o <- order(mins) myData <- myData[,o]