rowIQRs: Estimates of the interquartile range for each row (column) in...

Description Usage Arguments Value Author(s) See Also Examples

Description

Estimates of the interquartile range for each row (column) in a matrix.

Usage

1
2

Arguments

x

A numeric NxK matrix.

...

Additional arguments passed to rowQuantiles() (colQuantiles()).

Value

Returns a numeric vector of length N (K).

Author(s)

Henrik Bengtsson

See Also

See IQR. See rowSds().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
set.seed(1)

x <- matrix(rnorm(50*40), nrow=50, ncol=40)
str(x)

# Row IQRs
q <- rowIQRs(x)
print(q)
q0 <- apply(x, MARGIN=1, FUN=IQR)
stopifnot(all.equal(q0, q))

# Column IQRs
q <- colIQRs(x)
print(q)
q0 <- apply(x, MARGIN=2, FUN=IQR)
stopifnot(all.equal(q0, q))

Example output

 num [1:50, 1:40] -0.626 0.184 -0.836 1.595 0.33 ...
 [1] 1.1731306 1.0107162 1.6654064 1.2539423 1.3705467 1.6404858 1.6995732
 [8] 1.3291742 1.6886054 1.2549506 0.9359126 1.0195589 1.4007595 1.2198987
[15] 1.0787055 1.4524548 1.2556678 1.6562935 0.9436753 1.5332922 1.0804972
[22] 1.3345150 1.3778290 1.2813150 1.1560162 1.2670159 1.6274822 1.0123151
[29] 1.3011232 0.9232206 1.3664274 1.6141894 1.3007675 1.3635105 1.1991735
[36] 1.1799147 1.5664136 1.1915430 1.3908429 1.2292913 1.3337325 1.1083987
[43] 1.1150356 1.3610511 1.9523920 1.1711522 1.8068631 1.4450980 1.7511271
[50] 1.1295912
 [1] 1.100049 1.178648 0.916382 1.523818 1.233231 1.177970 1.248359 1.281653
 [9] 1.305779 1.463096 1.121270 1.524690 1.262950 1.608730 1.937564 1.666534
[17] 1.370162 1.238580 1.341196 1.214581 1.610758 1.488645 1.361843 1.332965
[25] 1.244894 1.507090 1.172773 1.349565 1.511738 1.213386 1.241099 1.408363
[33] 1.050347 1.389932 1.806088 1.377805 1.241565 1.241594 1.234828 1.580717

matrixStats documentation built on May 2, 2019, 4:52 p.m.