Skip to contents

This function loops through a list of matrices and returns the maximum number of columns found across all matrices in the list.

Usage

max_columns_list(matrix_list)

Arguments

matrix_list

A list containing matrices. Non-matrix elements will be ignored with a warning.

Value

An integer representing the maximum number of columns across all matrices in the list.

Examples

mat1 <- matrix(1:6, nrow = 2)
mat2 <- matrix(1:12, nrow = 3)
mat3 <- matrix(1:4, nrow = 2)
max_columns_list(list(mat1, mat2, mat3)) # Returns 2
#> [1] 4