bkt: Block transpose matrix

View source: R/matrix_blocks.R

bktR Documentation

Block transpose matrix

Description

Transpose a matrix by blocks, so block(s,r) becomes block(r,s), but elements within each block are not transposed.

Usage

bkt(df)

Arguments

df

A block matrix with named rows and columns. Names of countries and sectors are automatically identified.

Details

bkt() takes a matrix of ⁠c1 x c2⁠ blocks where each block has a dimension ⁠s1 x s2⁠ and transposes its blocks. Block B21 becomes B12, B31 becomes B13, etc., but blocks are not altered internally. For instance, a matrix with rows 5 exporting countries of 4 sectors each and columns with 3 importing countries with 2 aggregated sectors, i.e., a (5 x 4) x (3 x 2), matrix will become a (3 x 4) x (5 x 2) matrix. The rows will now show the importing countries and the sectors they import from, and the columns will show the the exporting countries and the sectors they export from.

Value

Block transposed version of df.

See Also

bktt().

Examples

wio <- make_wio("wiodtest", quiet = TRUE)
# Matrix Ym (exports of final products)
wio$Ym
# Block transposed version of Ym (imports of final products)
bkt(wio$Ym)

exvatools documentation built on Sept. 17, 2024, 1:07 a.m.