Skip to contents

This function determines whether two objects have the same structure,

  • which includes the mode, class and dimension

  • but does not include concrete values or attributes.

Usage

identical_structure(x, y)

Arguments

x, y

[any]
Two objects.

Value

Either TRUE if x and y have the same structure, and FALSE, else.

Examples

identical_structure(integer(1), 1L)
#> [1] TRUE
identical_structure(diag(2), matrix(rnorm(4), 2, 2))
#> [1] TRUE
identical_structure(diag(2), data.frame(diag(2)))
#> [1] FALSE