1

I have a data frame with 739 variables and I want to winsorize within each variable (i.e. column).

library(DescTools) 

Using the below code, the data are winsorized using the entire data frame. Since I cannot manually winsorize each column, is there are way to apply this function within column?

EEG_w<-Winsorize(EEG[3:739], minval = NULL, maxval = NULL, probs = c(0.05, 0.95),  na.rm = TRUE)
G5W
  • 36,531
  • 10
  • 47
  • 80

1 Answers1

1

You can apply Winsorize column by column using apply.

EEG_w<-apply(EEG, 2, Winsorize, na.rm = TRUE)
G5W
  • 36,531
  • 10
  • 47
  • 80