Regression of dummy variables in R

Viewed 11235

I am new to R and I am trying to performa regression on my dataset, which includes e.g. monthly sales data of a company in different countries over multiple years.

In other statistical programs, in order to control for quarterly cyclical movement of sales as well as for the regional (country) differences, I would create dummy variables indicating e.g. quarters and countries where sales are made.

My questions:

1) I saw that in R you can set a variable type to 'Factor'. Do I in this case still need to create dummy variables indicating countries and months/quarters, or is R already treating the factor variables differently and is automatically converting them to dummies in the background?

2) If the above is not the case, and I indeed need to recode my values into 0,1 dummies, is there a neat standard way in R to do it?

Thanks a lot for your help and have a nice day!

Trgovec

2 Answers
Related