In this recipe, we will learn how we can visualize more than one categorical variable into a single plot and see what it looks like. The command structure will be similar, but this will be applicable for factor variables.
Let's call the modified mtcars
dataset once again. After loading the modified mtcars
dataset we will select a subset of that data by taking only the factor variables:
cat_dat <- modified_mtcars[c("cyl","vs","am","gear","carb")]
Now, we will use this data to produce a plot.
The command structure is the same as with the continuous data but the input variables are factors in this case:
tableplot(cat_dat,sortCol=carb)