R/mergeclust.R

Defines functions mergeclust

Documented in mergeclust

mergeclust <- function(clustering,from,to)
{ 
    clustering <- as.integer(clustify(clustering))

    if (length(from) != length(to))
        stop("Vectors 'from' and 'to' must be the same length")
    for (i in 1:length(from))  clustering[clustering==from[i]] <- to[i]
    out <- list()
    out$clustering <- as.numeric(factor(clustering))
    class(out) <- 'clustering'
    attr(out,'call') <- match.call()
    attr(out,'timestamp') <- date()
    out
}

Try the optpart package in your browser

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

optpart documentation built on March 26, 2020, 6:18 p.m.