Print matrix to screen

sfcr_matrix_display(matrix, which = "tfm")

Arguments

matrix

A balance sheet or transactions-flow matrix

which

A character string for the matrix. Is it a balance-sheet or a transactions-flow matrix? here are two options: "bs" for balance-sheet matrices, and "tfm" for transactions- flow matrices. The default is "tfm".

Details

This function takes a matrix as input and generate a kableExtra table with math symbols displayed in latex style.

Note

This function converts the math expressions used to build the sfcr_matrix into a latex format, but cannot add modifications to it. The user is invited to explore the source code and the kableExtra package in order to personalize his/her own matrices.

Author

João Macalós

Examples

# Balance-sheet matrix bs_insout <- sfcr_matrix( columns = c("Households", "Firms", "Government", "Central bank", "Banks", "Sum"), codes = c("h", "f", "g", "cb", "b", "s"), r1 = c("Inventories", f = "+INV", s = "+INV"), r2 = c("HPM", h = "+Hhd", cb = "-Hs", b = "+Hbd"), r3 = c("Advances", cb = "+As", b = "-Ad"), r4 = c("Checking deposits", h = "+M1h", b = "-M1s"), r5 = c("Time deposits", h = "+M2h", b = "-M2s"), r6 = c("Bills", h = "+Bhh", g = "-Bs", cb = "+Bcb", b = "+Bbd"), r7 = c("Bonds", h = "+BLh * pbl", g = "-BLs * pbl"), r8 = c("Loans", f = "-Ld", b = "+Ls"), r9 = c("Balance", h = "-V", f = 0, g = "+GD", cb = 0, b = 0, s = "-INV") ) sfcr_matrix_display(bs_insout, "bs")
#> <table style="color: black; width: auto !important; margin-left: auto; margin-right: auto;" class="table table-striped table-hover"> #> <thead> #> <tr> #> <th style="text-align:left;"> </th> #> <th style="text-align:left;"> Households </th> #> <th style="text-align:left;"> Firms </th> #> <th style="text-align:left;"> Government </th> #> <th style="text-align:left;"> Central bank </th> #> <th style="text-align:left;"> Banks </th> #> <th style="text-align:left;"> $\sum$ </th> #> </tr> #> </thead> #> <tbody> #> <tr> #> <td style="text-align:left;"> Inventories </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $+INV$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $+INV$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> HPM </td> #> <td style="text-align:left;"> $+Hhd$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-Hs$ </td> #> <td style="text-align:left;"> $+Hbd$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Advances </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $+As$ </td> #> <td style="text-align:left;"> $-Ad$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Checking deposits </td> #> <td style="text-align:left;"> $+M1h$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-M1s$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Time deposits </td> #> <td style="text-align:left;"> $+M2h$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-M2s$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Bills </td> #> <td style="text-align:left;"> $+Bhh$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-Bs$ </td> #> <td style="text-align:left;"> $+Bcb$ </td> #> <td style="text-align:left;"> $+Bbd$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Bonds </td> #> <td style="text-align:left;"> $+BLh\cdot pbl$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-BLs\cdot pbl$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Loans </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $-Ld$ </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> </td> #> <td style="text-align:left;"> $+Ls$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> Balance </td> #> <td style="text-align:left;"> $-V$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $+GD$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $-INV$ </td> #> </tr> #> <tr> #> <td style="text-align:left;"> $\sum$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> <td style="text-align:left;"> $0$ </td> #> </tr> #> </tbody> #> </table>