R/findTh.R

Defines functions `findTh`

`findTh` <-
function(x, groups = 2, hclustm = "complete", distm = "euclidean") {
    x <- sort(x)
    cutpoints <- cumsum(rle(cutree(hclust(dist(x, method = distm), method = hclustm), k = groups))[[1]])
    values <- rep(NA, groups - 1)
    for (i in seq(length(values))) {
        values[i] <- mean(x[seq(cutpoints[i], cutpoints[i] + 1)])
    }
    return(values)
}

Try the QCApro package in your browser

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

QCApro documentation built on May 1, 2019, 10:09 p.m.