Hi, A practical way migh be> out<-rep(matrix(arg),4)-ma > out[2,]<--out[2,];out[5,]<--out[5,] > out[,1] [,2] [,3] [,4] [1,] 0.8 0.4 0.80 1.0 [2,] 1.0 0.0 1.00 0.3 [3,] 0.7 0.9 0.65 1.0 [4,] 1.0 0.5 0.60 0.9 [5,] 0.5 1.0 0.00 1.0 Best Ozgur -- View this message in context: http://r.789695.n4.nabble.com/Ifelse-on-matrix-using-a-vector-argument-tp4632485p4632487.html Sent from the R help mailing list archive at Nabble.com.
A generalized procedure for real life datasets might be out<-rep(matrix(arg),ncol(ma))-ma out[which(arg==0),]<--out[which(arg==0),] out Ozgur -- View this message in context: http://r.789695.n4.nabble.com/Ifelse-on-matrix-using-a-vector-argument-tp4632485p4632490.html Sent from the R help mailing list archive at Nabble.com.