factor R Factor Levels Factor is a data structure used for fields that takes only predefined finite number of. The only re…