Skip to contents

Threshold a matrix by setting the variables less than threshold to 0

Usage

threshold_W(W, threshold = 0.1)

Arguments

W

A matrix

threshold

A threshold value

Value

W with values less than threshold set to 0

Examples

W <- matrix(c(0, 0.6, -0.5, 1e-3), nrow = 2, byrow = TRUE)
threshold_W(W, threshold = 0.1)
#>      [,1] [,2]
#> [1,]  0.0  0.6
#> [2,] -0.5  0.0