0 votes
1 view
in R Programming by (6.5k points)
Can anyone tell me what is a factor in R programming?

1 Answer

0 votes
by (35.4k points)

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:

  1. as.factor("Name of column")
  2. 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !