I want to prevent running the i=j case and substitute it as NA in R. Here I prepared a small example. When i=j, I have the output 0. But I want to print it as NA. How can I do this one? Thanks.
n = 5
for(j in 1:(n-1)){
for(i in 0:(n-2)){
print(2^(abs(i-j)))
}
}
The outputs are 2, 1, 2, 4,....