matrix_threshold {NetComp} | R Documentation |
Returns matrix with values above or below the threshold
are replaced.
Can be used for converting to a binary matrix or for thresholding an adjacency
matrix.
matrix_threshold(matrix, threshold=NULL, minval=0, maxval=NULL, abs=TRUE, rmna=FALSE,...)
matrix |
matrix |
threshold |
Integer |
minval |
Integer. Replaces values below threshold. |
maxval |
Integer. Replaces values above or equal to |
abs |
Logical. If TRUE the absolute value will be considered. |
rmna |
Logical. If TRUE NA's will be replaced with |
... |
Other parameters. |
If rm.na
is TRUE and minval
is NULL, then NA's will be replaced
with 0.
max_threshold
returns an matrix with values removed according to parameters.
Shannon M. Bell
#using USArrest dataset arrestCor<-cor(t(USArrests)) arrestCor.7<-matrix_threshold(arrestCor, threshold=0.7, minval=0, abs=TRUE, rm.na=FALSE) arrestCor[10:15,1:5] arrestCor.7[10:15,1:5]