我正在使用 data.table J 来做子集th1
在 5 列上:split1, market, dept_size, bool_3, cust_poor_rich
.
我明白我应该使用unique(column_name)
指定该列应包含任何值。
尽管我使用此命令遇到以下警告:
setkey(th1, split1, market, dept_size, bool_3, cust_poor_rich)
subs = th1[J(0, unique(market), unique(dept_size), 1, factor(1)), nomatch=0]
Warning message:
In as.data.table.list(i) :
Item 3 is of size 5 but maximum size is 34 (recycled leaving a remainder of 4 items)
我尝试用一个小例子重现该错误,但无法重现。
我想Item 3
指的是 J() 中的第三个输入,我可以看到length(unique(th1$dept_size))
is 5.
但是哪里有34
来自?
为什么要留下剩余的 4 件物品?