[英]Why does all.equal(1,2,3) return TRUE
I tried all.equal(1,2)
and it returned a mean difference of 1. 我尝试了
all.equal(1,2)
,它的平均差为1。
Why does all.equal(1,2,3)
show TRUE
? 为什么
all.equal(1,2,3)
显示TRUE
?
Is it because if it is supplied more than two variables it runs is.numeric() on its different elements to check their type instead of numerical differences? 是因为如果提供了两个以上的变量,它将在其不同元素上运行is.numeric()来检查其类型而不是数值差异?
Because 1 is equal to 2 within a tolerance of 3. From the docs: 因为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’.
Your 3 is the third argument, and so becomes the tolerance. 您的3是第三个参数,因此成为公差。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.