if (FALSE) { # .Platform$OS.type == "windows"
data(wine, package = "clusterMI")
require(clustrd)
set.seed(123456)
ref <- wine$cult
nb.clust <- 3
m <- 3 # number of imputed data sets. Should be larger in practice
wine.na <- wine
wine.na$cult <- NULL
wine.na <- prodna(wine.na)
#imputation
res.imp <- imputedata(data.na = wine.na, nb.clust = nb.clust, m = m)
#analysis using reduced kmeans
## apply the cluspca function on each imputed data set
res.ana.rkm <- lapply(res.imp$res.imp,
FUN = cluspca,
nclus = nb.clust,
ndim = 2,
method= "RKM")
## extract the set of partitions (under "list" format)
res.ana.rkm <-lapply(res.ana.rkm,"[[","cluster")
# pooling by NMF
res.pool.rkm <- fastnmf(res.ana.rkm, nb.clust = nb.clust)
## extract the partition corresponding to the best initialisation
part <- res.pool.rkm$best$clust
}
Run the code above in your browser using DataLab