2016-12-17 136 views
2

我试图all.equal(1,2)和它返回的1为什么all.equal(1,2,3)返回TRUE

平均差为什么all.equal(1,2,3)显示TRUE

是因为如果它提供了两个以上的变量,它会在其不同的元素上运行is.numeric()来检查它们的类型而不是数字差异?

回答

6

因为1是3的公差从文档内等于2:

target: R object. 

current: other R object, to be compared with ‘target’. 

    ...: Further arguments for different methods, notably the 
      following two, for numerical comparison: 

tolerance: numeric >= 0. Differences smaller than ‘tolerance’ are not 
      reported. The default value is close to ‘1.5e-8’. 

你3是第三参数,依此成为公差。

+2

'all.equal(2 + 2,5,1)' - 统计学家的笑话 –

相关问题