Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中的data.table:必须使用';on=';参数错误_R_Data.table - Fatal编程技术网

R中的data.table:必须使用';on=';参数错误

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

我是个新手,会说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_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)]