我试过all.equal(1,2),它的平均差异为1.
为什么要all.equal(1,2,3)表演TRUE?
是因为如果它提供了两个以上的变量,它在不同的元素上运行.numeric()来检查它们的类型而不是数值差异?
因为1等于2,容差为3.来自docs:
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’.
Run Code Online (Sandbox Code Playgroud)
你的3是第三个参数,因此成为容忍.