Say, i have three columns
x <- c(-10, 1:6, 50)
x1<- c(-20, 1:6, 60)
z<- c(1,2,3,4,5,6,7,8)
check outliers for x
bx <- boxplot(x)
bx$out
check outliers for x1
bx1 <- boxplot(x1)
bx1$out
now we must delete outliers
x <- x[!(x %in% bx$out)]
x
x1 <- x1[!(x1 %in% bx1$out)]
x1
but we have variable Z(nominal) and we must remove observations, which correspond to the outlier of variables x and x1, in our case it is 1 and 8 obs. of Z
How to do it? in output we must have
x x1 z
Na Na Na
1 1 2
2 2 3
3 3 4
4 4 5
5 5 6
6 6 7
Na Na Na