| Title: | Block Diagonal Extraction or Replacement | 
| Version: | 6.4.0 | 
| Description: | Several tools for handling block-matrix diagonals and similar constructs are implemented. Block-diagonal matrices can be extracted or removed using two small functions implemented here. In addition, non-square matrices are supported. Block diagonal matrices occur when two dimensions of a data set are combined along one edge of a matrix. For example, trade-flow data in the 'decompr' and 'gvc' packages have each country-industry combination occur along both edges of the matrix. | 
| Depends: | R (≥ 2.10) | 
| License: | GPL-3 | 
| URL: | https://qua.st/diagonals, https://github.com/bquast/diagonals | 
| BugReports: | https://github.com/bquast/diagonals/issues | 
| Suggests: | testthat, knitr, rmarkdown | 
| VignetteBuilder: | knitr | 
| RoxygenNote: | 7.1.1 | 
| Encoding: | UTF-8 | 
| NeedsCompilation: | no | 
| Packaged: | 2022-06-19 18:16:33 UTC; bquast | 
| Author: | Bastiaan Quast | 
| Maintainer: | Bastiaan Quast <bquast@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2022-06-19 18:40:02 UTC | 
diagonals
Description
Several tools for handling block-matrix diagonals and similar constructs are implemented. Block-diagonal matrices can be extracted or removed using two small functions implemented here. In addition, non-square matrices are supported. Block diagonal matrices occur when two dimensions of a data set are combined along one edge of a matrix. For example, trade-flow data in the decompr' and 'gvc' packages have each country-industry combination occur along both edges of the matrix.
Author(s)
Bastiaan Quast bquast@gmail.com
See Also
https://qua.st/diagonals
Fat Matrix Diagonals
Description
Fat Matrix Diagonals
fatdiag set
Usage
fatdiag(x = 1, steps = NULL, size = NULL, nrow = NULL, ncol = NULL)
fatdiag(x, steps = NULL, size = NULL, on_diagonal = TRUE) <- value
Arguments
| x | a matrix where the dimensions are integer multiples of size or integer dividors of steps | 
| steps | the required number of steps (block matrices) across the diagonal | 
| size | the width or height of the matrix being dropped over the diagonal of matrix x | 
| nrow | the number of rows | 
| ncol | the number of columns | 
| on_diagonal | should the operation be applied to the elements on the fat diagonal. | 
| value | replacement value | 
Details
Either steps or size is expected to be provided.
Functions
-  fatdiag<-: the set version of fatdiag
Examples
fatdiag(12, steps=3)
( m <- matrix(111, nrow=6, ncol=9) )
fatdiag(m, steps=3) <- 5
fatdiag(m, steps=3)
fatdiag(12, size=4)
fatdiag(12, size=c(3,4) )
Split Vector
Description
Split Vector
Usage
split_vector(x, steps = NULL, size = NULL, replacement = 0)
Arguments
| x | a numeric or character vector | 
| steps | the number of steps | 
| size | the size of the step | 
| replacement | value to be inserted on the diagonal, by default this is zero (0). | 
Details
Either steps or size is expected to be provided.