Reputation: 1
ac0=c("WEIGHT","PREMENO","SMOKE") #this is the vector with names
ac1=glm(FRACTURE~PRIORFRAC+AGE+HEIGHT+MOMFRAC+RATERISK, data=glow, family='binomial')
ac2=update(ac1, formula.=~.+ac0[1])
Error is this:
Error in model.frame.default(formula = FRACTURE ~ PRIORFRAC + AGE + HEIGHT + :
invalid type (list) for variable 'ac0[1]'
Upvotes: 0
Views: 32
Reputation: 20399
You could create the formula and then pass it to update:
mF <- formula(paste(". ~ . +", ac0[1]))
update(ac1, mF)
Upvotes: 2