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