R/init.centers.R

Defines functions init.centers

Documented in init.centers

init.centers <- function(x, k, method = c("kmeans++", "random"))
{
    method <- switch ( match.arg(method), "kmeans++" = "kmeanspp", "random" = "random")
    
    if (! is.matrix(x)) stop("init.centers: x is not a matrix")
    if (k < 0) stop("init.centers: k < 0")

    centers <- .Call(cec_init_centers_r, x, as.integer(k), method);
    centers  
}

Try the CEC package in your browser

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

CEC documentation built on Sept. 21, 2021, 5:07 p.m.