powered by
Removes n rows and columns with NA values on all sides of a matrix.
n
NA
matrix
matrix_trim(m, n = 1)
A trimmed matrix, or NULL if trimming results in an "empty" matrix.
NULL
A matrix
By how many rows/columns to trim the matrix on each side?
m = matrix(1:80, nrow = 8, ncol = 10) m matrix_trim(m, 1) matrix_trim(m, 2) matrix_trim(m, 3) matrix_trim(m, 4)
Run the code above in your browser using DataLab