Convert categorical variables to numeric in R
You can use unclass() to display numeric values of factor variables : To do so on all categorical variables, you can use sapply() : EDIT : A5C1D2H2I1M1N2O1R2T1’s solution works in one step : It only works if your data.frame doesn’t contain any character variable though (otherwise, they’ll be put to NA).