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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.