for winzorizing a vector on 2 and 98 level :
library(DescTools)
d1<-c(1:100)
Winsorize(d1, minval = NULL, maxval = NULL, probs = c(0.02, 0.98),
na.rm = T, type = 1)
it worked fine ,
but i couldn't figure out how can I winzorize multiple column in a date frame at the same time
df <- diamonds
i want to winzorize the column from 5 till 8 , I tried to use the below code :
but didnt work with me
for (i in 5:8) {
Winsorize(df[,i], minval = NULL, maxval = NULL, probs = c(0.02, 0.98),
na.rm = T, type = 1)
}