0

I'm looking to winsorize my data and use the apply it across multiple columns. The only problems is the winsorize function itself requires information from each specific column.

test<-lapply(abcd_vars_filt, Winsorize, minval = mean(abcd_vars_filt$cbcl_scr_syn_internal_r) - 3sd(abcd_vars_filt$cbcl_scr_syn_internal_r), maxval = mean(abcd_vars_filt$cbcl_scr_syn_internal_r) + 3sd(abcd_vars_filt$cbcl_scr_syn_internal_r), na.rm = TRUE)

I have to define minval and maxval because the data I'm using is not normally distributed. These values need to use the mean and standard deviation from that specific column in order to winsorize the column. I would rather not copy and paste the same line 20+ times.

hamid
  • 1
  • You do not need to copy and paste 20+ times. But please read https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and provide us with such an example. – Andri Signorell Jul 04 '21 at 12:16

0 Answers0