Displaying 1 result from an estimated 1 matches for "3x3x3x4".
Did you mean:
3x3x3
2010 Mar 15
5
storing matrix(variables) in loop
Hello R-helpers,
I have the following code that works well,
b <-list()
for (i in 1:3){
a <- matrix(runif(1),3,3)
b[[i]] <- a
}
b
however, I need to do something similar with two loops and I was looking for
something that would look like
b <- list()
for (i in 1:3){
for (j in 1:4){
a <- matrix(runif(1),3,3)
b[[i,j]] <- a #but this doesn?t work
}
}
Anyway, I wanted