matchColumns: Match number of columns

matchColumnsR Documentation

Match number of columns

Description

Internal soundgen function

Usage

matchColumns(
  matrix_short,
  nCol,
  padWith = 0,
  padDir = "central",
  interpol = c("approx", "spline")[1]
)

Arguments

matrix_short

input matrix

nCol

the required number of columns

padWith

the value to pad with, normally 0 or NA

padDir

specifies the affected side. For padding, it is the side on which new elements will be added. For trimming, this is the side that will be trimmed. Defaults to 'central'

Details

Adds columns of new values (eg zeros or NAs) to a matrix, so that the new number of columns = len

Examples

a = matrix(1:9, nrow = 3)
soundgen:::matchColumns(a, nCol = 6, padWith = NA, padDir = 'central')
soundgen:::matchColumns(a, nCol = 6, padWith = 0, padDir = 'central')
soundgen:::matchColumns(a, nCol = 6, padWith = NA, padDir = 'left')
soundgen:::matchColumns(a, nCol = 6, padWith = 'a', padDir = 'right')
soundgen:::matchColumns(a, nCol = 2)

soundgen documentation built on Sept. 29, 2023, 5:09 p.m.