Session Ready
Exercise

Creating a Factor

The term factor refers to a statistical data type that is used to store categorical variables. The difference between a categorical variable and a continuous variable is that a categorical variable can belong to a limited number of categories. A continuous variable, however, can correspond to an infinite number of values.

  • The mode of a factor is numeric.
  • The class of a factor is factor.

To create factors in R you make use of the function factor().

Instructions
100 XP
  • Call the function factor() on the vector country and assign it to the variable country.