Row-wise minimum and maximum of a matrix.
Row-wise minimum and maximum of a matrix.
rowMins(x, value = FALSE) rowMaxs(x, value = FALSE) rowMinsMaxs(x)
x |
A numerical matrix with data. |
value |
If the value is FALSE it returns the indices of the minimum/maximum, otherwise it returns the minimum and maximum values. |
A vector with the relevant values.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
x <- matrix( rnorm(500 * 500), ncol = 500 ) system.time( s1 <- rowMins(x) ) system.time( s2 <- apply(x, 1, min) ) system.time( s1 <- rowMaxs(x) ) system.time( s2 <- apply(x, 1, max) ) system.time( s1 <- c(apply(x, 1, min),apply(x, 1, max) )) system.time( s2 <- rowMinsMaxs(x) ) x<-s1<-s2<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.