Column-wise minimum and maximum | R Documentation |
Column-wise minimum and maximum of a matrix.
colMins(x, value = FALSE, parallel = FALSE, cores = 0)
colMaxs(x, value = FALSE, parallel = FALSE, cores = 0)
colMinsMaxs(x, parallel = FALSE, cores = 0)
x |
A numerical matrix or data.frame with data. |
value |
If the value is FALSE it returns the indices of the minimum/maximum, otherwise it returns the minimum and maximum values. |
parallel |
Do you want to do it in parallel in C++? TRUE or FALSE. The parallel will return the minimum/maximum value only. It will never return the indices. |
cores |
Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores. |
A vector with the relevant values.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
rowMins, rowMaxs, nth, colrange, colMedians, colVars, colSort, rowSort
x <- matrix( rnorm(100 * 200), ncol = 200 )
s1 <- colMins(x)
s2 <- apply(x, 2, min)
s1 <- colMaxs(x)
s2 <- apply(x, 2, max)
s1 <- colMinsMaxs(x)
s2 <- c(apply(x, 2, min), apply(x, 2, max))
x<-s1<-s2<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.