我有一个包含多行和 3 列的数据集。第一列race
用0
s、1
s 和NA
s 填充。我试图拉出与0
s 相对应的行,同时也忽略任何NA
s。
我的代码:
dt = data.table(cbind((data[,'race']), (data[,'age']), (data[,'sex'])))
data = dt[complete.cases(dt), ] #remove the NAs
subset(data,race == 0)
我不断收到此错误,但我不确定这意味着什么:
Error in `[.data.table`(x, r, vars, with = FALSE) :
i is invalid type (matrix). Perhaps in future a 2 column matrix could
return a list of elements of DT (in the spirit of A[B] in FAQ 2.14).
Please let datatable-help know if you'd like this, or add your
comments to FR #1611.