smedmad: Calculate the median and median absolute deviation of the...

View source: R/smedmad.R

smedmadR Documentation

Calculate the median and median absolute deviation of the values from a contiguous subsection of specified vector.

Description

Compute the median and the median absolute deviation, only a contiguous subsection of the vector is used for the calculation

Usage

smedmad(pos, v)

Arguments

pos

a vector of 2 integer that represent the first and last positions of vector v to used for the calculation.

v

a vector of double containing the values used for the calculation. However, only a subsection of the vector, as set by pos, is used.

Value

a vector of 2 double which are the median and the median absolute deviation of the values.

Author(s)

Alexander Krasnitz, Guoli Sun

Examples


## A vector with the first and last positions to subset the value vector
position <- c(1, 5)

## A value vector used to do the calculation
values <- c(0.172073840, 0.012913919, 0.134459489, 0.040994620, -0.182843732,
    0.093052725, 0.170908930, 0.086624752, -0.003855011, -0.195791649)
    
## Calculate the median and median absolute deviation of the values from the 
## subsetted vector
CNprep:::smedmad(pos=position, v=values)


KrasnitzLab/CNprep documentation built on May 28, 2022, 8:32 p.m.