R data.table error - typeof x!= typeof i

时间:2014-05-20 08:20:15

标签: r data.table

我在尝试执行data.table join时遇到错误:

setkey(th1, split1, market, dept_size, bool_3)

th1[J(split1_training_value,markets[m], chains[c], dept_sizes[d], bool_3_value)]
Error in `[.data.table`(th1, J(split1_training_value, markets[m], chains[c],  : 
  typeof x.dept_size (double) != typeof i.dept_size (integer)

我检查了结构和输入,我确实有相同的类(数字),所以我不明白这个问题:

> class(dept_sizes[d])
[1] "numeric"

> class(th1$dept_size)
[1] "numeric"

> typeof(dept_sizes[d])
[1] "double"
> typeof(th1$dept_size)
[1] "double"

0 个答案:

没有答案