Description Usage Arguments Value Examples
View source: R/winsorizeMatrix.R
Winsorizing of an entire matrix. Here, winsorization consists in replacing extreme values in a matrix by the corresponding upper and lower quantiles.
1 | winsorizeMatrix(mat, low = 1, high = 99, verbose = FALSE)
|
mat |
A matrix to winsorize |
low |
Numeric. A value in [0,100]. All the values below |
high |
Numeric. A value in [0,100]. All the values above |
verbose |
Logical. Default to FALSE. If |
A matrix with extreme values replaced by the corresponding quantiles.
1 2 3 4 5 6 7 8 9 | ## Create a matrix with random number from N(0,1):
set.seed(123)
x <- matrix(rnorm(1e4), ncol=100)
## Replace the top and bottom 1% extreme values by the corresponding quantiles:
y <- winsorizeMatrix(x, low=1, high=99, verbose = TRUE)
## Add some NA in x:
x[x>2] <- NA
## winsorizeMatrix still works
y <- winsorizeMatrix(x, low=1, high=99, verbose = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.