Skip to content
Prev 16696 / 398498 Next

Functions on matrix row level

On Mon, 28 Jan 2002, Arndt, Ulrich, VF-VP wrote:

            
Only 0.12 secs on my machine.  You did set max to numeric(1000) first?
More comprehensible, but not necessarily much faster is

mymax <- apply(mymatrix, 1, max)

(0.03 secs)

Try to avoid confusing people (and perhaps R) by calling objects the same
name as system ones (max, matrix).

For average, rowMeans in R-devel is much faster still, if you need to save
another 0.03 seconds ....