# (R) can I convert a categorical variable into a numeric equivalent in linear regression to predict a continuous variable?

Specifically, I have an item code as one of the independent variables that can have several hundred possible values results in underfitting when predicting the projected availability of that item. I'd like to replace that item code with a numeric equivalent. Something like using weight of evidence in logistic regression.

• Can you share one example of your data with dput()? It would put us in a better place to help you out. Nov 25 '21 at 5:12