invert_byname: Invert a matrix

View source: R/Unary.R

invert_bynameR Documentation

Invert a matrix

Description

This function transposes row and column names as well as row and column types. Rows and columns of a are sorted prior to inverting.

Usage

invert_byname(a)

Arguments

a

the matrix to be inverted. a must be square.

Value

the inversion of a

Examples

m <- matrix(c(10,0,0,100), nrow = 2, dimnames = list(paste0("i", 1:2), paste0("c", 1:2))) %>%
  setrowtype("Industry") %>% setcoltype("Commodity")
invert_byname(m)
matrixproduct_byname(m, invert_byname(m))
matrixproduct_byname(invert_byname(m), m)
invert_byname(list(m,m))

matsbyname documentation built on April 2, 2022, 1:06 a.m.