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 <liuwensui at gmail.com>:> 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 at 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