In addition to using the -
like in the comments
glm(Stuff ~ . - var1 - var2, data= mydata, family=binomial)
you can also subset the data frame passed in
glm(Stuff ~ ., data=mydata[ , !(names(mydata) %in% c('var1','var2'))], family=binomial)
or
glm(Stuff ~ ., data=subset(mydata, select=c( -var1, -var2 ) ), family=binomial )
(be careful with that last one, the subset function sometimes does not work well inside of other functions)
You could also use the paste
function to create a string representing the formula with the terms of interest (subsetting to the group of predictors that you want), then use as.formula
to convert it to a formula.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…