matrix_trim {starsExtra}R Documentation

Trim matrix

Description

Removes n rows and columns with NA values on all sides of a matrix.

Usage

matrix_trim(m, n = 1)

Arguments

m

A matrix

n

By how many rows/columns to trim the matrix on each side?

Value

A trimmed matrix, or NULL if trimming results in an "empty" matrix.

Examples

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)

[Package starsExtra version 0.2.8 Index]