R factors, levels, labels

Conclusion
By default, factor() order the levels alphabetical order or numerical order.
If you want to change the sorting order of levels manually, you need to set it when the factor is created.
It can not be changed later, even though the levels can be changed.

When creating a factor, the data and the order should be matched as the example.

R factors levels labels # sample data originally…
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *