R/iqr.R

iqr <-
function (x, na.rm = FALSE) 
{
    wna <- which.na(x)
    if (length(wna)) {
        if (na.rm) 
            x <- x[-wna]
        else return(NA)
    }
    ret.val <- diff(quantile(x, probs = c(0.25, 0.75)))
    names(ret.val) <- NULL
    ret.val
}

Try the EnvStats package in your browser

Any scripts or data that you put into this service are public.

EnvStats documentation built on Sept. 11, 2024, 6:03 p.m.