Learn R Programming

tester (version 0.1.2)

is_square_matrix: Is square matrix

Description

Test if a matrix is square (or not) (i.e. same number of rows as number of columns)

Usage

is_square_matrix(x)

Arguments

x
a matrix

Examples

Run this code
m1 = matrix(1:9, 3, 3)
m2 = matrix(1:12, 4, 3)

is_square_matrix(m1) # TRUE
is_square_matrix(m2) # FALSE
is_not_square_matrix(m2) # TRUE

Run the code above in your browser using DataLab