Menu

Suppose we have a data frame as follows:

Looks good. But here is the issue

It is sorted alphabetically, which might not be the best in this case. We can use ordered()  to create an ordered factor variable.

But in case of Category, it is sorted alphabetically by default. But if we want to change its order, we can use factor() .