Deletes or adds whole rows/columns at the edges of A –
TDA's mtrim. A positive count deletes that many rows or
columns from that edge; a negative count adds that many zero
rows/columns instead. leading_cols/trailing_cols
act on the first and last columns, leading_rows/
trailing_rows on the first and last rows.
Usage
tda_mtrim(
A,
leading_cols = 0,
leading_rows = 0,
trailing_cols = 0,
trailing_rows = 0,
dir = tempfile("tda")
)See also
Other matrix reshaping:
tda_mag(),
tda_mcath(),
tda_mcvec(),
tda_mrsum(),
tda_msort(),
tda_msrow()
Examples
A <- matrix(1:4, 2)
tda_mtrim(A, leading_cols = 1) # drop the first column
#> [,1]
#> [1,] 3
#> [2,] 4
tda_mtrim(A, leading_cols = -1) # add a zero column in front
#> [,1] [,2] [,3]
#> [1,] 0 1 3
#> [2,] 0 2 4