So I'm trying to do a nested for loop that will multiple 1:100 with 1:100 (10,000 possible combinations). So 1*1, 1*2 ... 1* 100. Once it reaches 100, I want it to repeat, so 2*1, 2*2, 2*100.
Of note: I need to be doing this using for loops
table<-matrix(ncol=3, nrow=100*100)
for (i in 1:100) {
for (z in 1:100){
answer<-i*z
table[i,] <- c(i,z,answer)
}
}
Here's my code above. It seems like an easy fix, but I'm missing something..