R中的data.table:必须使用';on=';参数错误
我是个新手,会说R语言。我有两个数据表,如下所示:R中的data.table:必须使用';on=';参数错误,r,data.table,R,Data.table,我是个新手,会说R语言。我有两个数据表,如下所示: rts: id rt 1: 10_1 3180 2: 10_10 1680 3: 10_100 720 4: 10_11 1060 5: 10_16 760 choice: id v1 v2 decision rt condition_id 1: 10_1 4 2 1 3173 4_2 2: 10
rts:
id rt
1: 10_1 3180
2: 10_10 1680
3: 10_100 720
4: 10_11 1060
5: 10_16 760
choice:
id v1 v2 decision rt condition_id
1: 10_1 4 2 1 3173 4_2
2: 10_10 3 3 1 1678 3_3
3: 10_100 2 2 1 716 2_2
4: 10_11 6 5 1 1057 6_5
5: 10_16 5 8 2 760 5_8
当我使用此代码在选项中选择rts时:
choice = choice[rts]
我得到了这个错误:
Error in `[.data.table`(choice, rts) :
When i is a data.table (or character vector), the columns to join by must be specified using 'on=' argument (see ?data.table),
by keying x (i.e. sorted, and, marked as sorted, see ?setkey), or by sharing column names between x and i (i.e., a natural join).
Keyed joins might have further speed benefits on very large data due to x being sorted in RAM.
你能帮帮我吗?我能做什么?
谢谢。我们可以在的“id”上使用join
choice[rts, on = .(id)]
您可能需要选择[rts,on=(id)]