这些类型的比较未实施R.

时间:2017-01-10 15:47:03

标签: r

我有两个数据框,其中列作为因素,我试图将它们进行比较,但这会导致错误。我在这里做错了什么?该比较适用于元素0但

 Browse[2]> meta['Strip.']
          Strip.
    1 01/03/2017
    2 01/07/2017
    3 01/11/2017
    4 01/05/2017
    Browse[2]> opts['Strip.']
          Strip.
    1 01/03/2017
    2 01/07/2017
    3 01/11/2017
    4 01/05/2017
    Browse[2]> opts[4,'Strip.'] 
    [1] 01/05/2017
    Levels: 01/03/2017 01/05/2017 01/07/2017 01/11/2017
    Browse[2]> meta[4,'Strip.'] 
    [1] 01/05/2017
    Levels: 01/03/2017 01/05/2017 01/07/2017 01/11/2017
    Browse[2]> meta['Strip.'] == opts[4,'Strip.'] 
    Error in meta["Strip."] == opts[4, "Strip."] : 
      comparison of these types is not implemented
    In addition: Warning message:
    Incompatible methods ("Ops.data.frame", "Ops.factor") for "==" 

我的完全比较提取同一行,我有循环迭代i。

  meta.line <- meta[ meta['Strip.'] == opts[i, 'Strip.'] &meta['Contract_type.'] == opts[i, 'Contract_type.'] & meta['Strike.'] == opts[i,'Strike.'], ]

0 个答案:

没有答案