iqrCalc: Shows the steps in the manual calculation of the median and...

Description Usage Arguments Value Note See Also Examples

View source: R/sims-teaching.R

Description

Shows the steps in the manual calculation of the median and IQR.

Usage

1
2
3
4
iqrCalc(x, mdnInBoth = FALSE)

## S3 method for class 'iqrCalc'
print(x, ...)

Arguments

x

A numeric vector

mdnInBoth

A logical that indicates whether the median should be placed into both halves or not (DEFAULT) when computing the IQR with odd n.

...

Other arguments to the generic print functions (not currently used)

Value

A list containing the sample size (n); the sample Q1, median, and Q3 in the name vector vals; the positions of the sample Q1, median, and Q3 in the named vector pos; the ordered data (x); and the ordered lower- (lwr) and upper-halves (upr) of the data.

Note

This function shows the ordered data with the median shown and the ordered lower- and upper-halves of data with the Q1 and Q3 values shown. This function puts the median into both halves of the data to compute Q1 and Q3.

See Also

sdCalc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Simple examples
iqrCalc(1:7)
iqrCalc(1:7,mdnInBoth=TRUE)
iqrCalc(1:8)
iqrCalc(1:8,mdnInBoth=TRUE)
iqrCalc(1:9)
iqrCalc(1:9,mdnInBoth=TRUE)
iqrCalc(1:10)
iqrCalc(1:10,mdnInBoth=TRUE)

## Somewhat more realistic
iqrCalc(sample.int(99,11,replace=TRUE))
iqrCalc(sample.int(99,12,replace=TRUE))
iqrCalc(sample.int(99,13,replace=TRUE))
iqrCalc(sample.int(99,14,replace=TRUE))

droglenc/NCStats documentation built on June 5, 2021, 2:06 p.m.