matrix_trim: Trim matrix

Description Usage Arguments Value Examples

View source: R/matrix_trim.R

Description

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

Usage

1
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

1
2
3
4
5
6
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)

starsExtra documentation built on Nov. 18, 2021, 5:08 p.m.