R/kmeansn.R

Defines functions kmeansn

kmeansn <- function(x,mink=2,maxk=10)
{

  x=as.matrix(x)
  ans=matrix(0,nrow=maxk-mink+1,ncol=nrow(x))
  for( k in c(mink:maxk) )
  {
    ans[k-1,]=kmeans(x,k,nstart = 300)[[1]]
  }
  rownames(ans)=c(mink:maxk)
  return(ans)
}
GaoLabXDU/CEPICS documentation built on June 9, 2020, 2:31 a.m.