encoding categorical data
Encoding Categorical Data in R for Data Science - Detechtor
We've learned how to install R and RStudio, import the dataset, and take care of missing data using the R language. Now I'm going you show you how to encode categorical data in R. If you take a look at our dataset, you'll see that we have two categorical variables. We have the county variables โ Nairobi, Kisumu, and Mombasa โ and we have the Purchased variables โ Yes and No. They're categorical variables, obviously because they have categories. Since machine learning models are based on mathematical/numerical equations, keeping the text in the categorical variables would definitely cause us some problems. We want to have'numbers only' in our equations.