R/lc_cutdot.R

Defines functions .lc_cut

.lc_cut <- function(x, n, fix_fitted=FALSE) {
    if (fix_fitted && any(x < 0))
        x <- x + abs(min(x))
    if (any(x < 0))
        stop("Negative fitted values found.")
    l <- lorenz(x, n)
    bp <- structure(numeric(length(x)), names=names(x))
    bp[rownames(l)[-seq_len(which.max(l[,"p"] - l[,"L"]))]] <- 1
    bp
}

Try the opticut package in your browser

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

opticut documentation built on May 2, 2019, 5:09 a.m.