R/cluster.Simpson.R

Defines functions cluster

Documented in cluster

cluster<- function(x,clusters)
{
  if ("Simpsons" %in% class(x)) stop("Simpsons object needed")
  
  Nclusters <- x$Nclusters
  
  splList <- split(x$alldata,x$alldata$clusterid)
  names(splList) <- paste("Cluster",1:Nclusters)
  
  if (!missing(clusters))
  {
    splList <- splList[clusters]
    mat <- do.call(rbind,splList)
    rownames(mat) <- NULL
    return(mat)
  }
  
  return(splList)
}

Try the Simpsons package in your browser

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

Simpsons documentation built on May 1, 2019, 10:08 p.m.