Description Usage Arguments Details Value Author(s) See Also Examples
The function removes those rows and columns from an input matrix that exclusively contain zero-valued off-diagonal elements.
1 | rm.discard.zeros(mat, tol = 0, silent = FALSE)
|
mat |
Input matrix (typically after using |
tol |
A (small) real number specifying a thresholf for removal of matrix elements (see 'Details'). |
silent |
A logical variable that determines if the number of removed rows and columns is printed by the function or not. |
The diagonal of the matrix is not included when counting the zeros in a row/column, i.e. a row/column is actually removed if the diagonal element is the only non-zero element in that row/column. The tolerance tol
specifies a threshold. Matrix elements below this threshold will be treated as if they were zero.
A matrix with zero-valued rows/colums removed.
Uwe Menzel <uwemenzel@gmail.com>
Remove noise from a random matrix by applying a threshold: rm.denoise.mat
1 2 3 4 5 6 7 8 | set.seed(777)
random.matrix <- create.rand.mat(size = 1000, distrib = "norm")$rand.matr
dim(random.matrix)
## After identification of a proper threshold:
cleaned.matrix <- rm.denoise.mat(random.matrix, threshold = 3.2, keep.diag = TRUE)
cl2.matrix = rm.discard.zeros(cleaned.matrix)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.