Pearson = matrix(nrow = 2, ncol = 2) for(i in 1:2) { for(j in 3:4 && k in 1:2) { pearson[i, k] = cor(iris[i], iris[j]) } } print(pearson).

This is my program and I want to work with 2 variables in same for loop but it is giving an error. Is there a way to use it like this "for(j in 3:4 && k in 1:2)" or there is no such way in r ?

More Anjani Dhrangadhariya's questions See All
Similar questions and discussions