[R-sig-ME] MCMCglmm models stored as elements in a list
Sven Hohenstein
sven.hohenstein at uni-potsdam.de
Mon Jun 24 11:40:34 CEST 2013
Hi,
> require(MCMCglmm)
> Ndata <- data.frame(y = rnorm(5, mean = 0, sd = sqrt(1)))
> m1 <- MCMCglmm(y ~ 1, data = Ndata,verbose = FALSE)
> m2<- MCMCglmm(y ~ 1, data = Ndata,verbose = FALSE)
> m3<- MCMCglmm(y ~ 1, data = Ndata,verbose = FALSE)
> r<-list(c(m1,m2,m3))
You should not combine your objects with the c() function since this
removes the model class from the objects. A list containing the three
models can be created with the following command:
r <- list(m1, m2, m3)
Once you have this list, you can apply a function to all of its
elements with lapply():
lapply(r, summary)
You can also select a single list element by its index:
summary(r[[1]])
Best,
Sven
--
Sven Hohenstein
Department of Psychology
University of Potsdam
Karl-Liebknecht-Str. 24-25
14476 Potsdam
Germany
Tel.: ++49 331-977 2370
More information about the R-sig-mixed-models
mailing list