Posts by user1265067 • 111 points
1 post
-
1
votes3
answers1031
viewsA: Replace Zero and Infinity values in a matrix (R)
I think you could do something like: ind <- which(my.matrix==0, arr.ind=TRUE) apply(ind, 1, function(x) my.matrix[x[1], x[2]] <<- my.matrix[x[1], 1]) see if this is what you really wanted.…