Hi Community R,
in Table “A”, in Column “i” I have data that I would like to analyze. In the last Column of Table “A” are the values 0. I would like to replace these values to “1”, if in a given row in the Column “i” the value will turns out to be outlier.
How can I improve this code to make it effective and what I do wrong ? This code is very slow.
i=20
A[,ncol(A)] = lapply(A[,ncol(A)], FUN=function(y){
if(y>(quantile(A[,i],0.75)+IQR(A[,i])*1.5))
{y=1}
if(y<(quantile(A[,i],0.25)-IQR(A[,i])*1.5))
{y=1}
}
)