Factors
Summary

Instruction

Good job! By default, R creates levels in alphabetical order. For example, the order of levels in our phone variable is "N", "Y" because N alphabetically precedes Y. This default order is not a good solution when your categories have a natural order to them.

Exercise

Convert the price_category column from the houses data frame to a factor.

Create a bar chart using the price_category variable.

Stuck? Here's a hint!

Use barplot() in combination with the table() function. First, make a frequency table with the table() function, and then use it to construct the barplot.