[R] Ifelse on matrix using a vector argument

Özgür Asar oasar at metu.edu.tr
Wed Jun 6 07:43:27 CEST 2012


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.



More information about the R-help mailing list