I'll appreciate your help on this. I have values stored in a list as in
"mylist" below. I need to sum the values over all elements of the list
aggregated by the names of the matrices.
mylist <- list(matrix(c(0.2, 0.4), 1, 2, dimnames = list(NULL, c("1",
"2"))),
                    matrix(c(0.1, 0.5), 1, 2, dimnames = list(NULL, c("1",
"3"))),
                    matrix(c(0.3, 0.7), 1, 2, dimnames = list(NULL, c("2",
"5"))))
In this example, I'd like to get a single matix with the following values:

varname value
1       0.3   (i.e., 0.2 + 0.1)
2       0.7   (i.e., 0.4 + 0.3)
3       0.5   (i.e., 0.5)
5       0.7   (i.e., 0.7)

Any help is much appreciated.

Regards,
Axel.

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to