Can you give an example of a case where this would make sense? In general, categorical variables do not have a numeric value (that is why they are categorical) and even if you label them with numbers, as is done in a factor, there is no meaning to the distance between the values. For example, if my factor levels are apple, banana, cherry, I can assign those the numbers 1, 2 and 3 but cheery is not worth three times as much as apple.