R/fitted.cluspca.R

Defines functions fitted.cluspca

Documented in fitted.cluspca

fitted.cluspca <- function(object, mth = c("centers", "classes"), ...) 
{
  mth <- match.arg(mth)
  
  if (mth == "centers") 
    if (object$centroid != 0) {
      object$centroid[object$cluster, , drop = FALSE]
    } else {
      object$centroid[object$cluster]
    }
  else { 
    if (object$centroid != 0) {
      object$cluster
    } else {
      object$centroid[object$cluster]
    }
  }
}

Try the clustrd package in your browser

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

clustrd documentation built on July 17, 2022, 1:05 a.m.