I have two lists (and possibly more):
col.prop <-
structure(list(B = structure(c(0.5, 0.5, 0.6, 0.4, 0.555555555555556,
0.444444444444444), class = c("cast_matrix", "matrix"), .Dim = 2:3,
.Dimnames = list(
NULL, NULL)), D = structure(c(1, 0, 0.666666666666667,
0.333333333333333,
0.8, 0.2), class = c("cast_matrix", "matrix"), .Dim = 2:3, .Dimnames = list(
NULL, NULL))), .Names = c("B", "D"))
n <-
structure(list(B = c(4, 5, 9), D = c(4, 6, 10)), .Names = c("B",
"D"))
> col.prop
$B
[,1] [,2] [,3]
[1,] 0.5 0.6 0.5555556
[2,] 0.5 0.4 0.4444444
$D
[,1] [,2] [,3]
[1,] 1 0.6666667 0.8
[2,] 0 0.3333333 0.2
> n
$B
[1] 4 5 9
$D
[1] 4 6 10
I would like to "rbind" each element with the corresponding element of each
list ($B with $B and $D with $D):
> res
$B
[,1] [,2] [,3]
[1,] 0.5 0.6 0.5555556
[2,] 0.5 0.4 0.4444444
[3,] 4 5 9
$D
[,1] [,2] [,3]
[1,] 1 0.6666667 0.8
[2,] 0 0.3333333 0.2
[3,] 4 6 10
I've made an ugly loop to do this... Is there an easier way?
Thank you very much.
David
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.