Linear Regression in R: Need to convert categorical variables to factor or character? I'm running a linear regression in R.
If i have an independent variable Gender with only values 0 (for Male) and 1 (for Female), do i need to convert them to factor or character?
What is going to be the impact on my analysis?
 A: A factor variable with n levels, are represented as n - 1 binary variables. Thus if this categorical variable is already 0-1 binary, then there is no need to code it as factor variable. 
The only subtle issue, is the meaning of 0 and 1. Consider the following example:
## raw binary variable
set.seed(0); x <- sample(0:1, 8, replace = TRUE)

Without coding it into a factor, we have a model matrix:
> model.matrix(~x)
  (Intercept) x
1           1 1
2           1 0
3           1 0
4           1 1
5           1 1
6           1 0
7           1 1
8           1 1

Now, if we code it into a factor, there are two ways of coding:
x1 <- factor(x, levels = c(0, 1))
x2 <- factor(x, levels = c(1, 0))

R will drop the first level for contrasting, so the model matrix generated are slightly different:
model.matrix(~ x1)
  (Intercept) x11  ## x11 means level 1 of variable x1
1           1   1
2           1   0
3           1   0
4           1   1
5           1   1
6           1   0
7           1   1
8           1   1

> model.matrix(~ x2)
  (Intercept) x20  ## x20 means level 0 of variable x1
1           1   0
2           1   1
3           1   1
4           1   0
5           1   0
6           1   1
7           1   0
8           1   0

Representations are equivalent, but interpretation of the resulting coefficients will be different.
A: You need to turn the categorical variables into factor for the regression to deal with them as such. contrasts() can be used to check the way R thinks about the base level, against which other levels are compared. relevel() can be used to change the base level if needed.
