我希望将列名传递给函数,并使用列索引和setorder函数:data(iris)
setorder(t,(Species, n)])top3(DT, Petal.Width)Error in setorderv(x, cols, order, na.last) : some columns are not in the <em
我有一个函数,给定一个输入向量,返回一个data.frame或data.table;列数和列名取决于输入。我想使用data.table的一列作为函数的输入,将这些列添加到现有的data.table中。在data.table中执行此操作的最简单/最干净的方法是什么 # Example function; in this case the