Вы не говорите , как вы хотите оценить пары матриц, но если у вас есть ваши матрицы в соответствии с кодом, который вы показали с этими именами, тогда
g <- c("g11", "g12", "g13", "g21", "g22", "g23", "g31", "g32", "g33", "g2")
cmb <- combn(g, 2)
что дает:
> cmb
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,] "g11" "g11" "g11" "g11" "g11" "g11" "g11" "g11" "g11" "g12" "g12" "g12"
[2,] "g12" "g13" "g21" "g22" "g23" "g31" "g32" "g33" "g2" "g13" "g21" "g22"
[,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24]
[1,] "g12" "g12" "g12" "g12" "g12" "g13" "g13" "g13" "g13" "g13" "g13" "g13"
[2,] "g23" "g31" "g32" "g33" "g2" "g21" "g22" "g23" "g31" "g32" "g33" "g2"
[,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36]
[1,] "g21" "g21" "g21" "g21" "g21" "g21" "g22" "g22" "g22" "g22" "g22" "g23"
[2,] "g22" "g23" "g31" "g32" "g33" "g2" "g23" "g31" "g32" "g33" "g2" "g31"
[,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45]
[1,] "g23" "g23" "g23" "g31" "g31" "g31" "g32" "g32" "g33"
[2,] "g32" "g33" "g2" "g32" "g33" "g2" "g33" "g2" "g2"
- набор комбинаций ваших матриц, взятых за раз 2.
Затем выполните итерации по столбцам cmb
, выполняя вашу оценку, например:
FUN <- function(g, ...) {
## get the objects for the current pair
g1 <- get(g[1])
g2 <- get(g[2])
## bind together
dat <- rbind(g1, g2)
## something here to assess this combination
cpr2(dat)
}
assess <- apply(cmb, 2, FUN = FUN, ....)