Using the str
function, we saw that the region column stores a factor. You can corroborate this by using the class
function on the region column.
class(murders$region)
#> [1] "factor"
The question of this exercise is how many regions are included.
For this question we will combine two functions, in a nested way, to determine the number of unique categories. Use the functions levels
and length
to determine the number of regions defined by this dataset and contained in murders$region
.
NOTE
Do not forget to first load the data as in the previous exercises!