iqrCalc {NCStats} R Documentation

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

### Description

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

### Usage

```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.

`sdCalc`

### Examples

```## 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))

```

[Package NCStats version 0.4.7 Index]