Subset the rows and columns of a matrix by removing rows and columns with less than the specified number of non-zero elements.
SubsetMatrix( mat, min.rows = 1, min.cols = 1, max.row.val = 10, max.col.val = NULL )
mat | A matrix |
---|---|
min.rows | Minimum number of non-zero elements for the row to be retained |
min.cols | Minimum number of non-zero elements for the column to be retained |
max.row.val | Maximum allowed value in a row for the row to be retained. If NULL, don't set any limit. |
max.col.val | Maximum allowed value in a column for the column to be retained. If NULL, don't set any limit. |
Returns a matrix
SubsetMatrix(mat = volcano)#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] #> [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] #> [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] #> [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61]