Hi,
I want to remove the outliers of my database with the following program (an
observation is considered an outlier if it is bigger than second quartile +
1,5* distance interquartiles or less than second quartile - 1,5*distance
interquartiles):

for(i in 1:length(dados)){
q3=quantile(dados[i], probs=.75)
q3=quantile(dados[i], probs=.50)
q1=quantile(dados[i], probs=.25)
d=q3-q1
for(i2 in 1:length(dados$quest_1)) {
if (dados[i2,i] < q2-1.5*d) dados[i2,i]=NULL
else if (dados[i2,i] > q2+1.5*d) dados[i2,i]=NULL
}
}

But R is returning the following error message:

Erro em `[.data.frame`(x, order(x, na.last = na.last, decreasing =
decreasing)) :
  undefined columns selected

Anyone can help me fix this?

	[[alternative HTML version deleted]]

