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.
我想根据用户输入订购数据集。用户输入将是一个 char 数组(列名),下面称为 cols。
dataset1[do.call('order', as.list(dataset1[cols])),]
这工作正常。我也在尝试添加排序方向(降序或升序),但我不断收到相同的错误:“未使用的参数(降序 = TRUE)”。
任何人都可以在使用 char[] 列时帮助我设置排序方向吗?
我们可以将额外的参数放在 a 中list,将数据集与它连接起来并使用do.call
list
do.call
dataset1[do.call('order', c(dataset1[cols], list(decreasing=TRUE))),]