in R, how to set and retain custom levels in factor with different labels?
问题 in R, how to set and retain custom levels in factor with different labels ? That is, I want to set custom numbers in the levels of a factor, and these numerical values - integers to be retained and not converted to "1, 2, 3 etc.". I know that one solution is to set these weights as Labels, but then I will missing the "labels" of the factor. The "weighted" distance between factors is not retained. Is it possible in R, to achieve something like this, using a single variable ? For example: age_f