Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

colrange

Column and row-wise range of values of a matrix.


Description

Column and row-wise range of values of a matrix.

Usage

colrange(x, cont = TRUE)
rowrange(x, cont = TRUE)

Arguments

x

A numerical matrix with data.

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.

Value

A vector with the relevant values.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

Examples

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

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.