i am sorting a vector. my matrix is too large, so. here’s a simple example below instead.
x <- c(10,3,5)
x1 <- sort(x, decreasing=T)
print(x1)
10 5 3
loc_vals <- ???
print(loc_vals)
1 3 2
wondering how to get the location values of raw data after sorting as shown in the output of print(loc_vals)
many thanks,
Take a look at
It will give you the order of the vector’s entry after the sorting. Try