padding {funMoDisco} | R Documentation |
Pad a Matrix to a Specified Number of Rows
Description
This function pads a matrix with 'NA' values to ensure that the matrix reaches a specified number of rows ('maxLen'). If the matrix has fewer rows than the desired length, additional rows of 'NA' are appended to the matrix. Otherwise, the matrix is returned unchanged.
Usage
padding(dataMatrix, maxLen)
Arguments
dataMatrix |
A matrix to be padded. Each row represents a data point. |
maxLen |
An integer specifying the desired number of rows in the matrix. |
Details
The function compares the number of rows in 'dataMatrix' with 'maxLen'. If the matrix has fewer rows, it pads the matrix with 'NA' values until it reaches the specified number of rows. No changes are made if 'dataMatrix' has rows equal to or greater than 'maxLen'.
Value
A matrix padded with 'NA' values up to the specified number of rows. If 'dataMatrix' already has the desired number of rows or more, the original matrix is returned.