Multivariate categorical data visualization

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.

Getting ready

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.

How to do it…

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)

How it works…

Though the function to produce the plot ...

Get R: Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.