I'm trying to run a regression model. When I create it using the glm function like this:

lm.fit <- glm(res~., data=train) #res is class of my dataset

I get an error like this:

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels

my data set has15 variable, 10 of them are integer and 5 of them are factor.