Column and row-wise range of values of a matrix | R Documentation |
Column and row-wise range of values of a matrix.
colrange(x, cont = TRUE, parallel = FALSE,cores = 0)
rowrange(x, cont = TRUE)
x |
A numerical matrix or data.frame with data. |
parallel |
Execute algorithm in parallel for data.frame. |
cont |
If the data are continuous, leave this TRUE and it will return the range of values for each variable (column). If the data are integers, categorical, or if you want to find out the number of unique numbers in each column set this to FALSE. |
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>.
colMins, colMaxs, rowMins, rowMaxs, nth, colMedians, colVars, colSort, rowSort
x <- matrix( rnorm(100 * 100), ncol = 100 )
a1 <- colrange(x)
a2 <- apply(x, 2, function(x) diff( range(x)) )
all.equal(a1, a2)
a1 <- rowrange(x)
a2 <- apply(x, 1, function(x) diff( range(x)) )
all.equal(a1, a2)
x<-a1<-a2<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.