How to convert ordered categorical variable with 4 levels to quantatitve variable

47 views Asked by At

Have an ordered categorical variable with 4 levels that weve treated as a factor with 3 additional indicating variables and have concluded only one is significant and want to reassign this single significant variable to the original variable to make it a quantitative variable to perform PCA

1

There are 1 answers

0
demarsylvain On

Suppose variable v1 with levels A, B, C, D. You noticed only B is relevant and want to use this information in a PCA (so you need numerical/quantitative variables).

You can build the variable v2 <- 1 * (v1 == 'B').