I know I can use dplyr::select
to rearrange columns, but, concretely, if I have a sequence of numeric columns/variables, is there a way to tell select or another function to rearrange these variables from that having maximum variance to that having minimum variance in a decreasing order?
This question could be also applied for other functions instead of variance, or other rules (which could also apply to character variables)...