## An object of class "Cluster"" is usually created when constructing a "ClusteredSample".
## Unless you know exactly what you are doing, creating an object of class "Cluster"
## using new or using the constructor is discouraged.
## ------------------------------------------------
## load data and retrieve a sample
## ------------------------------------------------
library(healthyFlowData)
data(hd)
sample = exprs(hd.flowSet[[1]])
## ------------------------------------------------
## cluster sample using kmeans algorithm
## and retrive the parameters of the first cluster
## ------------------------------------------------
km = kmeans(sample, centers=4, nstart=20)
center1 = km$centers[1,]
# compute the covariance matrix of the first cluster
cov1 = cov(sample[km$cluster==1,])
size1 = length(which(km$cluster==1))
## ------------------------------------------------
## Create an object of class "Cluster"
## and show summary
## ------------------------------------------------
clust = Cluster(size=size1, center=center1, cov=cov1)
summary(clust)
Run the code above in your browser using DataLab