3.6 REEXPRESSION OF CATEGORICAL DATA AS NUMERIC
Figure 3.4 shows a bar graph5 of the education field. Note that the field is categorical, meaning that there is no ordering of the field values. In other words, if we left the field as it is, then our data science algorithms would not know that university_degree represents more education than basic.4yr. To provide this information to our algorithms, we transform the data values into numeric values, where it is clear that one value is larger than another. One needs to proceed with care when doing this, so that the relative differences among the various categories are preserved.
![Graph in R of the education variable, with bars for unknown, University.degree, Professional.course, illiterate, High.school, Basic.9y, Basic.6y, and Basic.4y. The highest bar is University.degree.](https://static.packt-cdn.com/products/9781119526810/graphics/images/c03f004.gif)
Figure 3.4 Bar graph in R of the education variable.
Table 3.1 shows how we plan to accomplish this transformation. The value of 12 for professional course was obtained from the publication shown in the footnote, as representing an alternative to the usual high‐school course of study. Of course, the unknown values will also need to be reexpressed as missing...