R: fix model call in model using as.formula
问题 I have a gls model in which I assign a formula (from another object) to the model: equation <- as.formula(aic.obj[row,'model']) > equation temp.avg ~ I(year - 1950) mod1 <- gls(equation, data = dat) > mod1 Generalized least squares fit by maximum likelihood Model: equation Data: dat Log-likelihood: -2109.276 However I do not want the "Model" to be "equation" but rather the quation itself! How do I do this?? 回答1: This is pretty standard, even lm would do this. One approach: hijack the print