One can not use a linear regression model with a factor as response variable which is same you are attempting to do here . Regression models do require numeric response variables. So you should instead look at classification models.
You may wish to start by restating your "type" variable as a logical binomial variable. Instead of a factor called "type" with two levels "A" and "B", you may create a new variable called "is.type.a", which should contain TRUE or FALSE.
So you should try a logistic regression based on a binomial distribution as follows :
model <- glm(is.type.a ~ age + gender,data=data,family="binomial")