# create a non-square matrix
nsm <- matrix(1:27, nrow=9, ncol=3 )
# check that both dimensions are multiples of steps=3
dim(nsm) %% 3 == c(0, 0)
# select the diagonal matrix
rectangle_matrix(nsm, steps=3)Run the code above in your browser using DataLab