identical2 | R Documentation |
The safe and reliable way to test two or more objects for being exactly
equal; returns TRUE
in this case, FALSE
in every other case.
identical2(
...,
num.eq = TRUE,
single.NA = TRUE,
attrib.as.set = TRUE,
ignore.bytecode = TRUE,
ignore.environment = FALSE
)
... |
any |
num.eq |
logical indicating if ( |
single.NA |
logical indicating if there is conceptually just one
numeric |
attrib.as.set |
logical indicating if |
ignore.bytecode |
logical indicating if byte code should be ignored
when comparing |
ignore.environment |
logical indicating if their environments should
be ignored when comparing |
A single logical value, TRUE
or FALSE
, never NA
and never anything other than a single value.
identical
; all.equal
for descriptions of how
two objects differ; Comparison
for operators that generate
element-wise comparisons; isTRUE
is a simple wrapper based
on identical
; all_equal2
identical2(1, 1.)
identical2(1, 1., 1L)
## for unusual R objects:
identical2(.GlobalEnv, environment(), globalenv(), as.environment(1))
identical2(0., 0, -0.) ## not differentiated
identical2(0., 0, -0., num.eq = FALSE)
identical2(NaN, -NaN)
identical2(NaN, -NaN, single.NA = FALSE) ## differ on bit-level
## for functions
f <- function(x) x
g <- compiler::cmpfun(f)
identical2(f, g)
identical2(f, g, ignore.bytecode = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.