Find the levels of factor of a given vector in R
Factors are the objects which are used to categorize the data and display the data as levels. The objects can be integer, character. They can be used to find the unique values in the given vector. The resulting data is known as levels. Factors are useful in statistical analysis in analyzing the categorical data. It is used to find the levels of the given vector. In this article, we are going to find the levels of factor in the given vector in R.
We can convert the vector data into factor by using factor() function, with this we can get levels() of the given vector
Result is factor levels.