hi all

i have a simple question. code is displayed below. 

how can i use a vectorised command in order to do this (ie replace the
loop)? (ie apply, lapply, sweep, etc)


z<-matrix(c(1:9),3,3)
top<-c(1.5,5.5,9)

for (i in 1:3)  z[z[,i]>top[i]]<-top[i]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to