Assume that the vector
vector<-c( 0.096846906, 0.068149926, -0.019938431, -0.095515090, -0.109936195, -0.006755265, -0.207243555, 0.117235435, -0.036333873, -0.156043650, -0.334150484,
0.141990040, -0.116270635, 0.079373531, 0.070359814, 0.090415147, 0.046807444, -0.024908308, 0.022005548, 0.015559027, 0.065343488, 0.039524657,
0.077209216, 0.051124695, 0.076794957, -0.059121977, 0.071967601, 0.042357348, 0.039801927, 0.053932640, -0.036346802, -0.070258993, -0.105611663,
-0.138738161, -0.044395825, -0.194363631, -0.127153662, 0.052912436, 0.163879916, 0.087960810, 0.005298789, -0.191104683, 0.113214756, 0.045232380)
a mean=-0.007702101
. I want to choose the values that are most different from the average. Suppose the 10 most distant values are from the mean.
I use this code to get the values that are farthest from the average:
sort(abs(vector-mean(vector)))
So now I have a number of differences that are ordered. But I can’t find a way to get the values (from the data with the name: vector) for which the greatest distance (again, the 10 most distant). I'm sure this is something simple, but I'm really stuck!