Re: [R] Problem with pmax and matrix to calculate row maxima

2011-10-12 Thread R. Michael Weylandt
I think Enrico's solution is probably better overall and doesn't require as much ugly behind-the-scenes trickery, but here's another fun way that seems to run ever-so-marginally faster on my machine. The vapply call is messy, but it seems to get the job done -- if it's not clear, the point is to b

Re: [R] Problem with pmax and matrix to calculate row maxima

2011-10-12 Thread Enrico Schumann
Hi Wolfgang, how about a loop? matRandom <- matrix(runif(n=60), ncol=6) ## variant 1 system.time(test1 <- pmax(matRandom[,1], matRandom[,2], matRandom[,3], matRandom[,4], matRandom[,5], matRandom[,6])) User System verstrichen 0.010.000.01 #