You can use functions like as.factor() to convert numeric variables to factors in the mtcars data set.