inst/dmat_related/demo/iris_dmat.r

### Setup environment.
suppressMessages(library(pbdDMAT, quietly = TRUE))
suppressMessages(library(pmclust, quietly = TRUE))
init.grid()

### Load data
X <- as.matrix(iris[, -5])

### Convert to ddmatrix
X.dmat <- as.ddmatrix(X)

### Standardized
X.std <- scale(X.dmat)

### Clustering
suppressMessages(library(pmclust, quietly = TRUE))
comm.set.seed(123, diff = TRUE)

ret.mb1 <- pmclust(X.std, K = 3)
comm.print(ret.mb1)

ret.kms <- pkmeans(X.std, K = 3)
comm.print(ret.kms)

### Finish
finalize()

Try the pmclust package in your browser

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

pmclust documentation built on Feb. 11, 2021, 5:05 p.m.