| all_identical | R Documentation |
all_identical checks if all provided objects are pairwise identical and returns a symmetric matrix showing the comparison results between all object pairs.
all_identical(..., names = NULL)
... |
Objects to compare for identity |
names |
Optional character vector of names for the objects. If not provided, objects will be named as "Obj1", "Obj2", etc. |
This function provides a comprehensive way to compare multiple objects at once, returning a matrix that shows all pairwise comparisons. This is particularly useful for testing and validation scenarios where you need to verify that multiple objects are identical.
A symmetric logical matrix where entry [i, j] indicates whether object i is identical to object j. The matrix has dimensions n x n where n is the number of objects, with row and column names from the names parameter.
identical() for pairwise object comparison,
matrix() for creating matrices
# Compare identical objects
x <- 1:5
y <- 1:5
z <- 1:5
# All objects are identical
result <- all_identical(x, y, z)
print(result)
# Compare different objects with custom names
a <- 1:3
b <- 1:5
c <- 1:3
result2 <- all_identical(a, b, c, names = c("first", "second", "third"))
print(result2)
# Single object case
single_result <- all_identical(x)
print(single_result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.