Sorting factors by r-value