Assuming newdata is the same for all the models and is included in a data.frame called New:
list_glm <- paste("glm", 1:10, sep = "") sapply(list_glm, function(x) predict(get(x), newdata = New)) Best, Renaud 2006/8/27, Wensui Liu <[EMAIL PROTECTED]>: > Dear Listers, > > If I have several glm objects with names glm1, glm2.... and want to apply > new data to these objects. Instead of typing "predict(glm1, newdata)..." 100 > times, is there way I could do so in a loop? > > Thank you so much! > > wensui > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint chargé des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 ______________________________________________ R-help@stat.math.ethz.ch 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.