# NOT RUN {
# sample data
data(data20)
# creating an object with results of hierarchical clustering of
hca.object <- nomclust(data20, measure = "lin", method = "average",
clu.high = 5, prox = TRUE, opt = FALSE)
# obtaining values of evaluation indices
data20.eval <- hca.object$eval
# getting the optimal numbers of clusters
data20.opt <- hca.object$opt
# extracting cluster membership variables
data20.mem <- hca.object$mem
# extracting cluster membership variables as a data frame
data20.mem <- as.data.frame(hca.object$mem)
# obtaining a proximity matrix
data20.prox <- hca.object$prox
# setting the maximal number of objects for which a proximity matrix is provided in the output to 30
hca.object <- nomclust(data20, measure = "lin", method = "average",
clu.high = 5, prox = 30, opt = FALSE)
# generating of a larger dataset containing repeatedly occuring objects
set.seed(150)
sample150 <- sample(1:nrow(data20), 150, replace = TRUE)
data150 <- data20[sample150, ]
# running hierarchical clustering WITH the time optimization
start <- Sys.time()
hca.object.opt.T <- nomclust(data150, measure = "lin", opt = TRUE)
end <- Sys.time()
end - start
# running hierarchical clustering WITHOUT the time optimization
start <- Sys.time()
hca.object.opt.F <- nomclust(data150, measure = "lin", opt = FALSE)
end <- Sys.time()
end - start
# }
Run the code above in your browser using DataLab