Defines functions clusterOne

Documented in clusterOne

#' Run one clustering using kmeans o PAM
#' @keywords internal
#' @return kmeans or PAM cluster assignments
#' @importFrom stats kmeans
clusterOne <- function(x, algorithm=c('kmeans', 'pam'), k=5) {
    algorithm <- match.arg(algorithm)
    if(algorithm == 'kmeans') yhat <- kmeans(x, k)$cluster
    else if(algorithm == 'pam') yhat <- cluster::pam(x, k)$clustering

Try the netSmooth package in your browser

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

netSmooth documentation built on Nov. 8, 2020, 5:33 p.m.