0
我想排序data.table
(R-3.3.1 Win x64 & data.table_1.9.6)的行,發現setorder
與base::sort
不同。我正確使用setorder嗎?比較data.table :: setorder針對base :: sort
dt <- data.table(A=c("AA","AB","Ab"))
setorder(dt, A)
identical(dt[,A], sort(dt[["A"]]))
#[1] FALSE
df <- data.frame(A=c("AA","AB","Ab"))
identical(df[order(df$A),"A"], sort(df[["A"]]))
#[1] TRUE