Hello David, of course I read those help pages and searched the r-help archive.
I agree that the way should be clear, but I am stuck and looking for help. Here is reproducible code removeTerm1 <- function(linModel, termName) { update(linModel, .~. - termName) } removeTerm2 <- function(linModel, termName) { update(linModel, .~. - as.name(termName)) } removeTerm3 <- function(linModel, termName) { update(linModel, .~. - eval(termName)) } removeTerm4 <- function(linModel, termName) { update(linModel, .~. - eval.parent(termName)) } removeTerm5 <- function(linModel, termName) { update(linModel, .~. - get(termName)) } myData <- data.frame(x1=rnorm(10), x2=rnorm(10), x3=rnorm(10), y=rnorm(10)) fit <- lm(y~x1+x2+x3, data=myData) # all this does not work, as I am expecting the function to return a lm object with formula y~x2+x3 removeTerm1(fit, "x1") removeTerm2(fit, "x1") removeTerm3(fit, "x1") removeTerm4(fit, "x1") removeTerm5(fit, "x1") Any help appreciated, kind regards, Karsten Weinert 2009/11/15 David Winsemius <dwinsem...@comcast.net>: > > You need to review: > > ?update > ?update.formula > ?as.formula > > The way should be clear at that point. If not, then include a reproducible > data example to work with. > > -- > David ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.