My problem is related to this loop:
for (i in 1:60){
for (j in 1:10){
for (k in 1:6){
PC12rotlist[i]<-Map("+", PC1rotlist[j], PC2rotlist[k])
}
}
}
where:
PC1rotlist is a list of 10 numeric vectors (double) [1:120]
PC2rotlist is a list of 6 numeric vectors (double) [1:120]
PC12rotlist is a list of 60 numeric vectors (double) [1:120]
As you can see, I am trying to get the sum of all possible combinations of vectors contained in two lists (PC1rotlist with 10 vectors and PC2rotlist with 6 vectors). The output should be then a list of 60 numeric vectors, containing the sums of all the possible combinations. However, I get a list where all the 60 vectors are the same, corresponding to the result of the last combination:
Map("+", PC1rotlist[10], PC2rotlist[6])
Could someone help me with this issue and let me know how I could store this ouput properly? I am not very familiarized with loops and I have been a couple of days trying to solve it without success.