I am wanting to apply the Grubbs test to a set of data repeatedly until it ceases to find outliers. I want the outliers flagged rather than removed so that I can plot the data as a histogram with the outliers a different colour. I have used grubbs.test from the outliers package to manually identify outliers but cannot figure out how to cycle through them and flag them successfully. The sort of output I am aiming for is like the following:
X Outlier
152.36 Yes
130.38 Yes
101.54 No
96.26 No
88.03 No
85.66 No
83.62 No
76.53 No
74.36 No
73.87 No
73.36 No
73.35 No
68.26 No
65.25 No
63.68 No
63.05 No
57.53 No
See Question&Answers more detail:os