[R] hwo can i get a vector that...

Scionforbai scionforbai at gmail.com
Wed Mar 7 23:36:04 CET 2007


> 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



More information about the R-help mailing list