### Outlier detection by evaluating a score as extreme
### This simple script first defines a range as 3 standard deviations around the mean
### Then, there are two logic tests. Does a chosen score ("6" in this example)
### fall outside of the range (and is therefore an outlier)
#Define upper extreme

upper_extreme<-mean(Wk04$opinion)+3*sd(Wk04$opinion)
lower_extreme<-mean(Wk04$opinion)-3*sd(Wk04$opinion)

6 >= upper_extreme #logical test if we exceed upper extreme
## [1] FALSE
6 <= lower_extreme #logical test if we fall below lower extreme
## [1] FALSE