In R programming, factors are the data type that represents different categories of values present in the data that are called categorical values. These categorical values are stored as levels. The factor data type supports storing both integers and strings. It is helpful while dealing with columns that contain a different set of unique values. Also, there are more data types such as character, numeric, vector, and int. You can convert factor to character and character to factor using the below queries, respectively:
- as.factor("Name of column")
- as.character("Name of column")
You can convert factor to character because of the non-mutable property of the factor data type.
If you are looking for an online course to learn R programming, check out this R Programming Course by Intellipaat.