https://github.com/cran/fields
Raw File
Tip revision: c71fb7f6ffa323303affebf0e35a0070faa9c24d authored by Doug Nychka on 10 May 2004, 00:00:00 UTC
version 1.7.2
Tip revision: c71fb7f
describe.bplot.r
"describe.bplot" <-
function (temp, style = "tukey", outlier = TRUE) 
{
    obj <- list()
    temp <- temp[!is.na(temp)]
    obj$N <- length(temp)
    obj$out <- numeric(0)
    obj$style <- style
if( obj$N <1) { obj$range<- NA
return( obj)}
    obj$range <- range(temp)
    if (style == "quantile") {
        quant <- c(0.05, 0.25, 0.5, 0.75, 0.95)
        out$bb <- quantile(temp, quant)
        if ((length(temp) > 5) & outlier) {
            obj$out <- temp[(temp < bb[1]) | (temp > bb[5])]
        }
        else obj$out <- temp
    }
    if (style == "tukey") {
        quant <- c(0.05, 0.25, 0.5, 0.75, 0.95)
# old line        bb <- quantile(temp, quant)
        obj$bb <- bb <- quantile(temp, quant)
        iqr <- bb[4] - bb[2]
        bb[1] <- min(temp[temp >= bb[2] - 1.5 * iqr])
        bb[5] <- max(temp[temp <= bb[4] + 1.5 * iqr])
        obj$bb <- bb
        if ((length(temp) > 5) & outlier) {
            obj$out <- temp[(temp < bb[2] - 3 * iqr) | (temp > 
                bb[4] + 3 * iqr)]
        }
        else obj$out <- temp
    }
    obj
}
back to top