  Course Content

# R Introduction: Part I

R Introduction: Part I

##   Levels

Good job! You might remember the `Levels: ` line while outputting some factors. What if you are interested in all the possible values of your factor values?

To output all the levels of a vector containing categorical values, use the `levels()` function, passing the vector as the parameter.  Well, these levels can be shuffled, and nothing will change. However, we may face factor variables that can be ordered. For example, we can call a person tall, medium, or short in terms of height. In that case, tall > medium > short. In R, you can consider this moment. You need to specify the `ordered` parameter to `T`. This will order variables alphabetically (if values are textual) or according to math laws (if numerical). The math laws are most likely acceptable for us, but alphabetical order is surely not. To set specific order, you need to also set the `labels` parameter to the vector of values in the ascending order. Watch out for the example.  You definitely can notice the difference. Practice by yourself!

1. Transform vector `grades` into factor type and save within `grades_f` variable considering the necessary order ('F < D < C < B < A').
2. Output entire `grades_f` variable. 