R Under development (unstable) (2025-06-25 r88360 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(symbolicDA) Loading required package: symbolicDA Loading required package: clusterSim Loading required package: cluster Loading required package: MASS Loading required package: XML > # Example 1 > library(stats) > data("cars",package="symbolicDA") > x<-cars > d<-dist_SDA(x, type="U_2") > wynik<-hclust(d, method="ward", members=NULL) The "ward" method has been renamed to "ward.D"; note new "ward.D2" > clusters<-cutree(wynik, 4) > G1d<-index.G1d(d, clusters) > print(G1d) [1] 334.1739 > > # Example 2 > > > data("cars",package="symbolicDA") > md <- dist_SDA(cars, type="U_3", gamma=0.5, power=2) > min_nc=2 > max_nc=10 > res <- array(0,c(max_nc-min_nc+1,2)) > res[,1] <- min_nc:max_nc > clusters <- NULL > for (nc in min_nc:max_nc) + { + cl2 <- pam(md, nc, diss=TRUE) + res[nc-min_nc+1,2] <- G1d <- index.G1d(md,cl2$clustering) + clusters <- rbind(clusters, cl2$clustering) + } > print(sprintf("max G1d for %f clusters=%.3f",max(res[,2]),(min_nc:max_nc)[which.max(res[,2])])) [1] "max G1d for 101.360663 clusters=9.000" > print("clustering for max G1d") [1] "clustering for max G1d" > print(clusters[which.max(res[,2]),]) [1] 1 2 3 4 5 5 6 3 7 7 3 7 8 6 4 5 1 9 6 4 4 2 1 9 6 4 2 6 4 2 > write.table(res,file="G1d_res.csv",sep=";",dec=",",row.names=TRUE,col.names=FALSE) > plot(res, type="p", pch=0, xlab="Number of clusters", ylab="G1d", xaxt="n") > axis(1, c(min_nc:max_nc)) > > proc.time() user system elapsed 23.85 1.29 25.21