The video below discusses the factor data type in R. Factors are the data type used to store categorical variables. In R, factors are recognized by statistical procedures such are linear least-squares regression (the lm() function) and handled appropriately.

The data file used in this video can be downloaded here. The R code file can be downloaded here.

In this video, I explain how to code categorical variables for use as explanatory variables (x-variables) in regression by using indicator or dummy variables. Categorical variables are very common in real data sets, so understanding how to create and use dummy variables is both very useful and important.

A pdf copy of the slides that are used in the video can be found here. The video also discusses an example which is implemented in Excel. The Excel file can be downloaded here.