This code to normalize variable x1 runs:
newdata <- subset(df3, abs(normalizeZ(x1)) >= 3)
cat("There are", nrow(newdata),"potential X1 outliers >= |3| in df3", "\n")
Output:
There are 128 potential X1 outliers >= |3| in df3
When I use the paste command as a parameter for a dataset there is a switch made from numeric to alphanumeric somewhere in the following code. I have tried to correct for that.
> for(i in 1:11){
+ v <- paste("x",i,sep="")
+ temp <- as.numeric(df3[[v]])
+ temp2 <- normalizeZ(temp)
+ newdata <- subset(df3, abs(temp2) >= 3)
+ cat("There are", nrow(newdata),"potential", v,"outliers >= |3| in df3" ,"\n")
+ }
Output:
There are 0 potential x1 outliers >= |3| in df3
There are 0 potential x2 outliers >= |3| in df3
There are 0 potential x3 outliers >= |3| in df3
There are 0 potential x4 outliers >= |3| in df3
There are 0 potential x5 outliers >= |3| in df3
There are 0 potential x6 outliers >= |3| in df3
There are 0 potential x7 outliers >= |3| in df3
There are 0 potential x8 outliers >= |3| in df3
There are 0 potential x9 outliers >= |3| in df3
There are 0 potential x10 outliers >= |3| in df3
There are 0 potential x11 outliers >= |3| in df3
Another attempt:
> for(i in 1:11){
+ v <- paste("x",i,sep="")
+ newdata <- subset(df3, abs(normalizeZ(df3[[v]])) >= 3)
+ cat("There are", nrow(newdata),"potential", v,"outliers >= |3| in df3" ,"\n")
+ }
Warning: argument is not numeric or logical: returning NAThere are 0 potential x1 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x2 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x3 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x4 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x5 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x6 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x7 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x8 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x9 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x10 outliers >= |3| in df3
Warning: argument is not numeric or logical: returning NAThere are 0 potential x11 outliers >= |3| in df3
>