this_example_runs_too_long <- TRUE
if (!this_example_runs_too_long) { # exclude from cran checks
## Cluster with SPgroup2, which contains deposition date and p_unstable
SPx <- SPgroup2
config <- clusterSPconfig(simType = 'wsum_scaled', ddate = T, pwls = T)
## Hierarchical clustering with k = 2
cl_hclust <- clusterSP(SPx, k = 2, type = 'hclust', config = config)
plot(cl_hclust)
## Precompute a distance matrix and cluster with PAM for k = 2 and 3
distmat <- do.call('distanceSP', c(list(SPx), config$args_distance))
cl_pam2 <- clusterSP(SPx, k = 2, type = 'pam', config = config, distmat = distmat)
cl_pam3 <- clusterSP(SPx, k = 3, type = 'pam', config = config, distmat = distmat)
print(cl_pam2$clustering)
print(cl_pam3$clustering)
## kdba clustering
config_kdba <- clusterSPconfig(simType = 'layerwise', type = 'kdba')
cl_kdba <- clusterSP(SPx = SPgroup2, k = 2, type = 'kdba', config = config_kdba)
plot(cl_kdba)
}
Run the code above in your browser using DataLab