更新时间:2023-02-02 22:24:05
使用 do.call
:
data[do.call("order", data[sortCols]), ]
其中 data
是数据框,而 sortCols
是列名的字符向量.
where data
is a data frame and sortCols
is a character vector of column names.
还可以查看doBy软件包中的 orderBy
.
Also have a look at orderBy
in the doBy package.