[R] Ifelse on matrix using a vector argument

Özgür Asar oasar at metu.edu.tr
Wed Jun 6 08:49:21 CEST 2012


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.



More information about the R-help mailing list