> canĀ“t believe in need a loop for this... No, you don't ;) > want to get a 100 x 1 vector Has each row unique values? If yes:
mat <- matrix(rnorm(300),nr=100) vet <- apply(mat,1,function(x) {return(which(x==max(x)))}) scionforbai ______________________________________________ R-help@stat.math.ethz.ch 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.