Description Usage Arguments Value Examples
Trim the rows and columns of a logical matrix until every row and columns has a specified level of TRUE values.
1 | matrixtrim(m, prop = c(1, 1), rowsfirst = TRUE)
|
m |
A logical matrix to be trimmed, should be all TRUE, FALSE (or 0, 1). |
prop |
A numeric vector of length two, the minimum proportion of TRUE values in each row and column of the trimmed matrix, default c(1, 1). |
rowsfirst |
A logical scalar, indicating if rows (TRUE, the default) or columns (FALSE) should be trimmed from the matrix first. |
A list of length three:
trim
=a logical matrix, the resulting trimmed matrix
dim
=a numeric vector of length 2, the dimensions of
trim
n
=a numeric scalar, the total number of TRUE values in
trim
1 2 3 4 | m <- matrix(rep(c(1, 0, 1, 0), c(4, 1, 13, 2)), nrow=5)
matrixtrim(m)
matrixtrim(m, rowsfirst=FALSE)
matrixtrim(m, prop=c(0.7, 0.7))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.