Created to add missing rows or columns to a matrix

maximizeMatrices(x, fillValue = 0)

maximizeMatrix(x, rowNames, colNames, fillValue = 0)

Arguments

x

Either a single data frame or matrix (for maximizeMatrix) or, more commonly, a list of data frames or matrces (for maximizeMatrices).

fillValue

The value to fill the new rows and columns with

rowNames, colNames

The names or the rows and columns as they should be in the final result

Value

A matrix with the specified rows and columns

Examples

metabefor::maximizeMatrix(
  mtcars[1:3, 1:4],
  rowNames = c('Mazda RX4', letters[1:3]),
  colNames = c('mpg', 'cyl', LETTERS[1:4])
);
#>           mpg cyl A B C D
#> Mazda RX4  21   6 0 0 0 0
#> a           0   0 0 0 0 0
#> b           0   0 0 0 0 0
#> c           0   0 0 0 0 0