I need to get the total number of outliers for variable1 for each type of variable2 and variable 3 and then show it in a table. It also needs to show only cases where variable4 is larger than 1.5. I have it working but I think there's something wrong with my code because the output for each is just 0, which isn't correct.
When I do boxplot.stats(df$variable1)$out I get a huge list of outliers. But when I use the code below, it just says 0 for each one.
high <- mean(df$variable1) + sd(df$variable1) * 3
low <- mean(df$variable1) - sd(df$variable1) * 3
df%>%
filter(varaible4>1.5)%>%
group_by(variable2, variable3) %>%
tally(variable1 < low ||variable1 > high)
A table shows up with each type of variable2 and variable3...but the tally just says 0 for each one.