Does anyone know how to sort a vector in R by absolute value, so (-2, 3, 1) -> (1, -2, 3)
etc?
If I were doing it in python I'd create a pair of every value and its sign, sort the list of pairs by the absolute value then reapply the sign, but I'm very new to R so have no idea how to do this.
Cheers