samestructure_byname: Test whether matrices or lists of matrices have same...

Description Usage Arguments Value Examples

View source: R/Binary.R

Description

Matrices are said to have the same structure if row and column types are identical and if row and column names are identical. Values can be different.

Usage

1

Arguments

...

operands to be compared

Value

TRUE if all operands have the same structure, FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
samestructure_byname(2, 2)
productnames <- c("p1", "p2")
industrynames <- c("i1", "i2")
U <- matrix(1:4, ncol = 2, dimnames = list(productnames, industrynames)) %>%
  setrowtype("Products") %>% setcoltype("Industries")
samestructure_byname(U, U)
samestructure_byname(U, U %>% setrowtype("row"))
samestructure_byname(U %>% setcoltype("col"), U)
# Also works with lists
samestructure_byname(list(U, U), list(U, U))

matsbyname documentation built on July 8, 2020, 6:55 p.m.