R/selectioncluster.R

Defines functions selectioncluster

selectioncluster <- function(d, K, method){
# To check whether there is some cluster with few units
pama <- function(d, K){
  p <- pam(d, K, diss=TRUE)$clustering
  return(p)
}  

dian <- function(d, K){
   aux <- diana(d, diss=TRUE)
   p <- cutree(aux, K)
   return(p)
}  


fannya <- function(d, K){
   p <- fanny(d, K, diss=TRUE)$clustering
   return(p)
} 


bestela <- function(d, K, method){
   aux <- agnes(d, diss=TRUE, method=method)
   p <- cutree(aux, K)
   return(p)
}  

 p <- switch(method,  pam=pama(d, K), diana=dian(d, K), fanny=fannya(d, K), bestela(d,K, method))

return(p)
}

Try the ICGE package in your browser

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

ICGE documentation built on Oct. 17, 2022, 5:10 p.m.