I am trying to make my matrix (tc) symmetric (using R) by adding the corresponding entries and divide those by the sum of the corresponding diagonal entries (tc[i,j]+tc[j,i])/(tc[i,i]+tc[j,j]). I tried it with loops but it does not give me the right values let alone make the matrix symmetric. This is my code so far:
for (i in 1:end){
for(j in 1:end){
tc[i,j]<-(tc[i,j]+tc[j,i])/(tc[i,i]+tc[j,j])
}
}
It's probably a super obvious mistake but I can't figure it out. Can anyone help me? =)