Solution: Create Plots with Categorical Data

Let's look at the solution to the previous exercise.

We'll cover the following

Solution

The plot() function is an essential and fundamental function in R. Let’s explore what happens when we give it a single vector of numbers.

When we provide plot() with the variable species, it plots a bar for each category with the height of the bar representing the number of observations in each category. In this case, that means three bars that are each ten units high.

Get hands-on with 1200+ tech skills courses.