File: clara.Rout.save

package info (click to toggle)
cluster 2.1.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,732 kB
  • sloc: ansic: 3,397; sh: 20; makefile: 2
file content (1494 lines) | stat: -rw-r--r-- 40,776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494

R Under development (unstable) (2023-10-19 r85354) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.

> library(cluster)
> 
> ## generate 1500 objects, divided into 2 clusters.
> suppressWarnings(RNGversion("3.5.0")) # << as long as we don't have R >= 3.6.0
> set.seed(144)
> x <- rbind(cbind(rnorm(700, 0,8), rnorm(700, 0,8)),
+            cbind(rnorm(800,50,8), rnorm(800,10,8)))
> 
> isEq <- function(x,y, epsF = 100)
+     is.logical(r <- all.equal(x,y, tol = epsF * .Machine$double.eps)) && r
> 
> .proctime00 <- proc.time()
> 
> ## full size sample {should be = pam()}:
> n0 <- length(iSml <- c(1:70, 701:720))
> summary(clara0 <- clara(x[iSml,], k = 2, sampsize = n0))
Object of class 'clara' from call:
 clara(x = x[iSml, ], k = 2, sampsize = n0) 
Medoids:
          [,1]      [,2]
[1,] -1.499522 -1.944452
[2,] 48.629631 12.998515
Objective function:	  10.23588 
Numerical information per cluster:
     size max_diss  av_diss isolation
[1,]   70 24.81995 10.25745 0.4744879
[2,]   20 19.07782 10.16040 0.3647145
Average silhouette width per cluster:
[1] 0.7144587 0.7090915
Average silhouette width of best sample: 0.713266 

Best sample:
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
[76] 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
Clustering vector:
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
[77] 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Silhouette plot information for best sample:
   cluster neighbor sil_width
45       1        2 0.8033727
60       1        2 0.8021017
55       1        2 0.8005931
66       1        2 0.8002776
58       1        2 0.7991899
11       1        2 0.7991773
41       1        2 0.7973302
26       1        2 0.7962397
63       1        2 0.7962229
13       1        2 0.7949705
67       1        2 0.7942590
54       1        2 0.7936184
17       1        2 0.7916087
16       1        2 0.7913570
39       1        2 0.7912755
6        1        2 0.7840455
34       1        2 0.7833568
49       1        2 0.7819733
9        1        2 0.7789087
23       1        2 0.7785009
32       1        2 0.7757325
22       1        2 0.7655369
61       1        2 0.7639754
12       1        2 0.7639644
5        1        2 0.7606436
18       1        2 0.7579145
56       1        2 0.7566307
3        1        2 0.7537894
24       1        2 0.7531180
50       1        2 0.7517817
48       1        2 0.7501998
25       1        2 0.7499655
59       1        2 0.7472022
19       1        2 0.7445038
65       1        2 0.7398395
28       1        2 0.7377377
38       1        2 0.7370935
7        1        2 0.7335940
40       1        2 0.7310012
14       1        2 0.7294895
62       1        2 0.7254478
70       1        2 0.7163214
4        1        2 0.7157257
21       1        2 0.7148663
64       1        2 0.7108496
2        1        2 0.7062831
15       1        2 0.7015120
52       1        2 0.6978313
37       1        2 0.6954023
31       1        2 0.6932905
33       1        2 0.6888478
10       1        2 0.6805028
20       1        2 0.6766854
43       1        2 0.6761461
8        1        2 0.6749706
27       1        2 0.6671817
35       1        2 0.6632888
68       1        2 0.6587599
30       1        2 0.6554989
36       1        2 0.6228481
53       1        2 0.6203313
57       1        2 0.6191666
42       1        2 0.6142020
47       1        2 0.6024151
1        1        2 0.5814464
69       1        2 0.5091186
46       1        2 0.4961302
44       1        2 0.4849961
29       1        2 0.4569316
51       1        2 0.4230181
81       2        1 0.7965942
71       2        1 0.7961971
85       2        1 0.7919593
74       2        1 0.7869047
82       2        1 0.7795304
78       2        1 0.7788873
79       2        1 0.7729041
72       2        1 0.7492980
88       2        1 0.7447973
87       2        1 0.7404399
76       2        1 0.7352351
77       2        1 0.7216838
86       2        1 0.7165677
84       2        1 0.6952406
73       2        1 0.6942882
83       2        1 0.6621568
80       2        1 0.6368446
90       2        1 0.5743228
75       2        1 0.5597232
89       2        1 0.4482549

4005 dissimilarities, summarized :
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.1865 11.5850 20.0580 27.8150 45.5780 85.2320 
Metric :  euclidean 
Number of objects : 90

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
>           pam0 <- pam  (x[iSml,], k = 2)
> stopifnot(identical(clara0$clustering, pam0$clustering)
+         , isEq(clara0$objective, unname(pam0$objective[2]))
+           )
> 
> summary(clara2 <- clara(x, 2))
Object of class 'clara' from call:
 clara(x = x, k = 2) 
Medoids:
          [,1]      [,2]
[1,]  2.012828 -1.896095
[2,] 51.494628 10.274769
Objective function:	  10.23445 
Numerical information per cluster:
     size max_diss  av_diss isolation
[1,]  700 36.84408 10.49814 0.7230478
[2,]  800 30.89896 10.00373 0.6063775
Average silhouette width per cluster:
[1] 0.7562366 0.7203254
Average silhouette width of best sample: 0.733384 

Best sample:
 [1]   21   23   50   97  142  168  191  192  197  224  325  328  433  458  471
[16]  651  712  714  722  797  805  837  909  919  926  999 1006 1018 1019 1049
[31] 1081 1084 1132 1144 1150 1201 1207 1250 1291 1307 1330 1374 1426 1428
Clustering vector:
   [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [186] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [223] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [260] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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 2 2 2 2 2 2 2 2 2 2
[1259] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1296] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1333] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1370] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1407] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1444] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1481] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Silhouette plot information for best sample:
     cluster neighbor sil_width
325        1        2 0.8261589
191        1        2 0.8206687
23         1        2 0.8149640
97         1        2 0.8048084
433        1        2 0.8017745
458        1        2 0.8008324
471        1        2 0.7958547
328        1        2 0.7689099
142        1        2 0.7619508
21         1        2 0.7607528
197        1        2 0.7606641
50         1        2 0.7509131
192        1        2 0.7098473
651        1        2 0.7035969
224        1        2 0.6843886
168        1        2 0.5337006
1084       2        1 0.8180447
1081       2        1 0.8171686
1201       2        1 0.8170847
1291       2        1 0.8167148
1307       2        1 0.8166841
1144       2        1 0.8159947
999        2        1 0.8135303
1426       2        1 0.8023538
1049       2        1 0.8022891
1250       2        1 0.8014300
712        2        1 0.7859324
837        2        1 0.7792784
1018       2        1 0.7764837
919        2        1 0.7651939
1374       2        1 0.7648534
1428       2        1 0.7516819
1330       2        1 0.7505861
1006       2        1 0.7368113
714        2        1 0.7237565
1150       2        1 0.7046060
1132       2        1 0.6940608
909        2        1 0.6859682
926        2        1 0.6725631
722        2        1 0.6572791
797        2        1 0.6395698
1019       2        1 0.6083662
805        2        1 0.2814164
1207       2        1 0.2694097

946 dissimilarities, summarized :
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.4846 12.3230 26.4990 32.2130 52.3910 77.1750 
Metric :  euclidean 
Number of objects : 44

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> 
> clInd <- c("objective", "i.med", "medoids", "clusinfo")
> clInS <- c(clInd, "sample")
> ## clara() {as original code} always draws the *same* random samples !!!!
> clara(x, 2, samples = 50)[clInd]
$objective
[1] 10.06735

$i.med
[1]  177 1115

$medoids
           [,1]      [,2]
[1,] -0.2538744 -1.209148
[2,] 50.0372683  9.501125

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 34.67208 10.193945 0.6743054
[2,]  800 29.51964  9.956571 0.5741003

> for(i in 1:20)
+     print(clara(x[sample(nrow(x)),], 2, samples = 50)[clInd])
$objective
[1] 10.05727

$i.med
[1] 936 192

$medoids
            [,1]         [,2]
[1,] 50.03726827  9.501124850
[2,] -0.03900399 -0.009078886

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.51964  9.956571 0.5791419
[2,]  700 34.06055 10.172348 0.6682295

$objective
[1] 10.05296

$i.med
[1]  468 1394

$medoids
           [,1]       [,2]
[1,] -0.3292826 -0.2398794
[2,] 50.0372683  9.5011249

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.98451 10.163128 0.6624677
[2,]  800 29.51964  9.956571 0.5754330

$objective
[1] 10.05852

$i.med
[1] 1171  379

$medoids
           [,1]       [,2]
[1,] 50.9444060  9.6723175
[2,] -0.3292826 -0.2398794

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 30.10388  9.966988 0.5764486
[2,]  700 33.98451 10.163128 0.6507574

$objective
[1] 10.07051

$i.med
[1]   75 1254

$medoids
           [,1]      [,2]
[1,] -0.9493373 0.3552542
[2,] 50.5455985 9.3904972

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.12704 10.191999 0.6336273
[2,]  800 29.66384  9.964205 0.5673860

$objective
[1] 10.0613

$i.med
[1] 199 134

$medoids
            [,1]         [,2]
[1,] -0.03900399 -0.009078886
[2,] 49.59384120  9.792964832

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 34.06055 10.172348 0.6732466
[2,]  800 29.57491  9.964138 0.5845827

$objective
[1] 10.06101

$i.med
[1] 1453 1122

$medoids
           [,1]       [,2]
[1,] 50.0372683 9.50112485
[2,] -0.9691441 0.03342515

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.51964  9.956571 0.5690241
[2,]  700 33.31923 10.180359 0.6422655

$objective
[1] 10.08603

$i.med
[1] 613 318

$medoids
           [,1]     [,2]
[1,] 50.0627056 9.478225
[2,] -0.2902194 1.026496

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.51131  9.957225 0.5780037
[2,]  700 33.21560 10.233240 0.6505552

$objective
[1] 10.07293

$i.med
[1] 618 406

$medoids
           [,1]       [,2]
[1,] 50.3621263  9.0207185
[2,] -0.2092816 -0.5916053

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.25143  9.990206 0.5682446
[2,]  700 34.30301 10.167473 0.6663777

$objective
[1] 10.0592

$i.med
[1] 1279 1349

$medoids
           [,1]        [,2]
[1,] 50.1502433 10.60358224
[2,] -0.9691441  0.03342515

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 30.54975  9.953191 0.5852356
[2,]  700 33.31923 10.180359 0.6382900

$objective
[1] 10.06241

$i.med
[1] 1293   21

$medoids
           [,1]      [,2]
[1,] 50.5809098 9.7418386
[2,] -0.9493373 0.3552542

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.98892  9.949013 0.5725461
[2,]  700 33.12704 10.191999 0.6324587

$objective
[1] 10.0592

$i.med
[1] 337 675

$medoids
           [,1]        [,2]
[1,] -0.9691441  0.03342515
[2,] 50.1502433 10.60358224

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.31923 10.180359 0.6382900
[2,]  800 30.54975  9.953191 0.5852356

$objective
[1] 10.05697

$i.med
[1]  22 574

$medoids
           [,1]       [,2]
[1,] 50.5809098 9.74183863
[2,] -0.9691441 0.03342515

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.98892  9.949013 0.5716937
[2,]  700 33.31923 10.180359 0.6351809

$objective
[1] 10.05096

$i.med
[1] 739 808

$medoids
           [,1]       [,2]
[1,] 50.5809098  9.7418386
[2,] -0.2092816 -0.5916053

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.98892  9.949013 0.5785936
[2,]  700 34.30301 10.167473 0.6618278

$objective
[1] 10.06135

$i.med
[1] 1431  485

$medoids
           [,1]       [,2]
[1,] 50.0627056 9.47822525
[2,] -0.9691441 0.03342515

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.51131  9.957225 0.5686352
[2,]  700 33.31923 10.180359 0.6420076

$objective
[1] 10.05324

$i.med
[1]   10 1221

$medoids
            [,1]         [,2]
[1,] 50.58090982  9.741838628
[2,] -0.03900399 -0.009078886

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.98892  9.949013 0.5817385
[2,]  700 34.06055 10.172348 0.6607218

$objective
[1] 10.06101

$i.med
[1] 1249 1411

$medoids
           [,1]       [,2]
[1,] -0.9691441 0.03342515
[2,] 50.0372683 9.50112485

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.31923 10.180359 0.6422655
[2,]  800 29.51964  9.956571 0.5690241

$objective
[1] 10.05296

$i.med
[1] 610  21

$medoids
           [,1]       [,2]
[1,] -0.3292826 -0.2398794
[2,] 50.0372683  9.5011249

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.98451 10.163128 0.6624677
[2,]  800 29.51964  9.956571 0.5754330

$objective
[1] 10.06486

$i.med
[1] 1101  397

$medoids
           [,1]       [,2]
[1,] -0.9691441 0.03342515
[2,] 50.1066826 9.35514422

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 33.31923 10.180359 0.6417479
[2,]  800 29.42336  9.963794 0.5667111

$objective
[1] 10.07521

$i.med
[1] 838 356

$medoids
            [,1]         [,2]
[1,] 50.36212634  9.020718482
[2,] -0.03900399 -0.009078886

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.25143  9.990206 0.5712766
[2,]  700 34.06055 10.172348 0.6651980

$objective
[1] 10.05906

$i.med
[1] 1270 1024

$medoids
           [,1]       [,2]
[1,] 50.5455985  9.3904972
[2,] -0.2092816 -0.5916053

$clusinfo
     size max_diss   av_diss isolation
[1,]  800 29.66384  9.964205 0.5734673
[2,]  700 34.30301 10.167473 0.6631526

> 
> clara(x, 2, samples = 101)[clInd]
$objective
[1] 10.05727

$i.med
[1]  286 1115

$medoids
            [,1]         [,2]
[1,] -0.03900399 -0.009078886
[2,] 50.03726827  9.501124850

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 34.06055 10.172348 0.6682295
[2,]  800 29.51964  9.956571 0.5791419

> clara(x, 2, samples = 149)[clInd]
$objective
[1] 10.05319

$i.med
[1]  238 1272

$medoids
           [,1]       [,2]
[1,] -0.2092816 -0.5916053
[2,] 50.1502433 10.6035822

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 34.30301 10.167473 0.6649301
[2,]  800 30.54975  9.953191 0.5921768

> clara(x, 2, samples = 200)[clInd]
$objective
[1] 10.05319

$i.med
[1]  238 1272

$medoids
           [,1]       [,2]
[1,] -0.2092816 -0.5916053
[2,] 50.1502433 10.6035822

$clusinfo
     size max_diss   av_diss isolation
[1,]  700 34.30301 10.167473 0.6649301
[2,]  800 30.54975  9.953191 0.5921768

> ## Note that this last one is practically identical to the slower  pam() one
> 
> (ii <- sample(length(x), 20))
 [1]  249  452 2663 2537 2235 2421 1004 1834 2602  397  717 2805 1575 1281  283
[16] 1657 1749  820  269  519
> ## This was bogous (and lead to seg.faults); now properly gives error.
> ## but for these, now see  ./clara-NAs.R
> if(FALSE) { ##		   ~~~~~~~~~~~~~
+     x[ii] <- NA
+     try( clara(x, 2, samples = 50) )
+ }
> 
> ###-- Larger example: 2000 objects, divided into 5 clusters.
> x5 <- rbind(cbind(rnorm(400, 0,4), rnorm(400, 0,4)),
+             cbind(rnorm(400,10,8), rnorm(400,40,6)),
+             cbind(rnorm(400,30,4), rnorm(400, 0,4)),
+             cbind(rnorm(400,40,4), rnorm(400,20,2)),
+             cbind(rnorm(400,50,4), rnorm(400,50,4)))
> ## plus 1 random dimension
> x5 <- cbind(x5, rnorm(nrow(x5)))
> 
> clara(x5, 5)
Call:	 clara(x = x5, k = 5) 
Medoids:
           [,1]      [,2]        [,3]
[1,]  0.5850466 -2.222194 -0.63631241
[2,]  8.0131143 42.708122 -0.31693240
[3,] 42.6657812 21.123133 -0.62411426
[4,] 50.6470292 48.480686 -0.09146223
[5,] 28.6470950 -2.544131 -0.22186047
Objective function:	 6.100721
Clustering vector: 	 int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 400 396 408 401 395 
Best sample:
 [1]   23  130  178  202  267  297  338  357  376  387  439  441  638  647  662
[16]  719  723  802  874  880  994 1038 1056 1097 1184 1215 1225 1268 1271 1282
[31] 1346 1442 1446 1474 1496 1515 1585 1590 1605 1641 1680 1687 1696 1728 1742
[46] 1761 1857 1909 1951 1956

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> summary(clara(x5, 5, samples = 50))
Object of class 'clara' from call:
 clara(x = x5, k = 5, samples = 50) 
Medoids:
           [,1]       [,2]        [,3]
[1,] -0.8427864  0.1606105 -0.70362181
[2,] 12.0389703 39.0303445  0.19158023
[3,] 39.6341676 20.7182868  0.43978514
[4,] 50.6470292 48.4806864 -0.09146223
[5,] 30.6814242 -0.1072177 -0.25861548
Objective function:	  5.743812 
Numerical information per cluster:
     size max_diss  av_diss isolation
[1,]  400 15.20728 5.207177 0.4823345
[2,]  397 24.25898 8.677062 0.7324727
[3,]  406 18.39064 4.369617 0.8109074
[4,]  401 18.28050 5.260543 0.6119680
[5,]  396 12.69653 5.243478 0.5598344
Average silhouette width per cluster:
[1] 0.7433532 0.6956424 0.7315944 0.7336104 0.7079360
Average silhouette width of best sample: 0.7188531 

Best sample:
 [1]  106  130  145  213  275  316  434  444  486  501  630  693  713  739  773
[16]  804  808  821  823  899  914  948  961  972  980  987 1076 1114 1126 1127
[31] 1169 1175 1203 1225 1228 1242 1269 1397 1405 1421 1595 1606 1658 1703 1777
[46] 1834 1857 1881 1937 1999
Clustering vector:
   [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [186] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [223] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [260] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [297] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1777] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1814] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1851] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1888] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1925] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1962] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[1999] 4 4

Silhouette plot information for best sample:
     cluster neighbor sil_width
130        1        5 0.8123353
275        1        5 0.7945197
316        1        5 0.7561799
213        1        5 0.7459412
106        1        5 0.6869957
145        1        5 0.6641473
630        2        3 0.7819320
739        2        3 0.7774128
486        2        3 0.7559683
713        2        3 0.7316982
444        2        3 0.7204625
501        2        3 0.7091146
773        2        1 0.6886472
693        2        3 0.5855803
434        2        3 0.5099654
1225       3        5 0.8105776
1203       3        5 0.7965773
1595       3        5 0.7842711
1269       3        5 0.7799931
1242       3        5 0.7625442
1397       3        5 0.7315512
1228       3        5 0.7262025
1421       3        5 0.6011616
1405       3        5 0.5914707
1999       4        3 0.8050046
1857       4        3 0.8030709
1658       4        3 0.7941141
1777       4        3 0.7865209
1937       4        3 0.7831996
1881       4        3 0.7504779
1834       4        3 0.6614223
1606       4        3 0.6373808
1703       4        3 0.5813025
804        5        3 0.8021043
987        5        3 0.7999064
1076       5        3 0.7907769
948        5        3 0.7905304
961        5        3 0.7716289
823        5        3 0.7657693
808        5        3 0.7510670
914        5        3 0.7358231
1175       5        3 0.7337485
1169       5        3 0.7254812
972        5        3 0.7118795
821        5        3 0.7101558
899        5        1 0.6580927
1114       5        3 0.6552887
1127       5        3 0.6292428
1126       5        3 0.5362475
980        5        1 0.4671695

1225 dissimilarities, summarized :
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.6968 19.3160 34.0920 33.0700 46.2540 92.2530 
Metric :  euclidean 
Number of objects : 50

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> ## 3 "half" samples:
> clara(x5, 5, samples = 999)
Call:	 clara(x = x5, k = 5, samples = 999) 
Medoids:
           [,1]       [,2]        [,3]
[1,]  0.2143499  0.3891695  0.45577894
[2,] 10.9779485 39.6788652 -0.23487762
[3,] 40.2944064 20.2221253  0.21417849
[4,] 50.7170411 49.7645642 -0.43318939
[5,] 29.7257398 -0.5981739 -0.05616701
Objective function:	 5.659041
Clustering vector: 	 int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 400 397 407 401 395 
Best sample:
 [1]    1    2  103  147  155  176  179  247  262  288  365  369  372  470  486
[16]  573  759  779  785  791  797  822  875  883  913  954 1107 1114 1154 1156
[31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800
[46] 1818 1845 1946 1948 1973

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> clara(x5, 5, samples = 1000)
Call:	 clara(x = x5, k = 5, samples = 1000) 
Medoids:
           [,1]       [,2]        [,3]
[1,]  0.2143499  0.3891695  0.45577894
[2,] 10.9779485 39.6788652 -0.23487762
[3,] 40.2944064 20.2221253  0.21417849
[4,] 50.7170411 49.7645642 -0.43318939
[5,] 29.7257398 -0.5981739 -0.05616701
Objective function:	 5.659041
Clustering vector: 	 int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 400 397 407 401 395 
Best sample:
 [1]    1    2  103  147  155  176  179  247  262  288  365  369  372  470  486
[16]  573  759  779  785  791  797  822  875  883  913  954 1107 1114 1154 1156
[31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800
[46] 1818 1845 1946 1948 1973

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> clara(x5, 5, samples = 1001)
Call:	 clara(x = x5, k = 5, samples = 1001) 
Medoids:
           [,1]       [,2]        [,3]
[1,]  0.2143499  0.3891695  0.45577894
[2,] 10.9779485 39.6788652 -0.23487762
[3,] 40.2944064 20.2221253  0.21417849
[4,] 50.7170411 49.7645642 -0.43318939
[5,] 29.7257398 -0.5981739 -0.05616701
Objective function:	 5.659041
Clustering vector: 	 int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 400 397 407 401 395 
Best sample:
 [1]    1    2  103  147  155  176  179  247  262  288  365  369  372  470  486
[16]  573  759  779  785  791  797  822  875  883  913  954 1107 1114 1154 1156
[31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800
[46] 1818 1845 1946 1948 1973

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> 
> clara(x5, 5, samples = 2000)#full sample
Call:	 clara(x = x5, k = 5, samples = 2000) 
Medoids:
           [,1]       [,2]        [,3]
[1,]  0.2143499  0.3891695  0.45577894
[2,] 10.5993345 39.8970536 -0.39199265
[3,] 40.3370139 20.3148331 -0.06033818
[4,] 50.7170411 49.7645642 -0.43318939
[5,] 29.7257398 -0.5981739 -0.05616701
Objective function:	 5.65785
Clustering vector: 	 int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 400 397 407 401 395 
Best sample:
 [1]   84  106  164  226  284  288  329  423  430  450  469  593  603  654  742
[16]  887  929  970  974 1035 1043 1096 1171 1187 1192 1302 1307 1327 1371 1431
[31] 1433 1439 1440 1452 1513 1522 1525 1548 1565 1593 1620 1639 1654 1688 1740
[46] 1761 1832 1845 1895 1899

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> 
> ###--- Start a version of  example(clara) -------
> 
> ## xclara : artificial data with 3 clusters of 1000 bivariate objects each.
> data(xclara)
> (clx3 <- clara(xclara, 3))
Call:	 clara(x = xclara, k = 3) 
Medoids:
            V1        V2
[1,]  5.553391 13.306260
[2,] 43.198760 60.360720
[3,] 74.591890 -6.969018
Objective function:	 13.225
Clustering vector: 	 int [1:3000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:	    	 900 1148 952 
Best sample:
 [1]   20   30   46   91   92  169  179  187  209  223  382  450  555  971 1004
[16] 1025 1058 1277 1281 1302 1319 1361 1362 1513 1591 1623 1628 1729 1752 1791
[31] 1907 1917 1946 2064 2089 2498 2527 2537 2545 2591 2672 2722 2729 2790 2797
[46] 2852

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> ## Plot similar to Figure 5 in Struyf et al (1996)
> plot(clx3)
> 
> ## The  rngR = TRUE case is currently in the non-strict tests
> ## ./clara-ex.R
> ## ~~~~~~~~~~~~
> 
> ###--- End version of example(clara) -------
> 
> ##  small example(s):
> data(ruspini)
> 
> clara(ruspini,4)
Call:	 clara(x = ruspini, k = 4) 
Medoids:
    x   y
10 19  65
32 44 149
52 99 119
67 66  18
Objective function:	 11.51066
Clustering vector: 	 Named int [1:75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "names")= chr [1:75] "1" "2" "3" "4" "5" "6" "7" ...
Cluster sizes:	    	 20 23 17 15 
Best sample:
 [1] 2  3  4  5  6  7  8  9  10 16 18 19 20 21 22 23 25 29 30 32 34 35 36 37 41
[26] 42 43 44 46 47 49 50 52 53 54 58 59 60 61 63 65 66 67 69 71 72 73 75

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> 
> rus <- data.matrix(ruspini); storage.mode(rus) <- "double"
> ru2 <- rus[c(1:7,21:28, 45:51, 61:69),]
> ru3 <- rus[c(1:4,21:25, 45:48, 61:63),]
> ru4 <- rus[c(1:2,21:22, 45:47),]
> ru5 <- rus[c(1:2,21,    45),]
> daisy(ru5, "manhattan")
Dissimilarities :
     1   2  21
2   11        
21 118 107    
45 143 132  89

Metric :  manhattan 
Number of objects : 4
> ## Dissimilarities :  11 118 143 107 132  89
> 
> ## no problem anymore, since 2002-12-28:
> ## sampsize >= k+1 is now enforced:
> ## clara(ru5, k=3, met="manhattan", sampsize=3,trace=2)[clInS]
> clara(ru5, k=3, met="manhattan", sampsize=4,trace=1)[clInS]
C clara(): (nsam,nran,n) = (4,5,4); 'full_sample',
 -> dysta2(); obj= 2.75
 resul(),  black() and return() from C.
$objective
[1] 2.75

$i.med
[1] 2 3 4

$medoids
    x   y
2   5  63
21 28 147
45 85 115

$clusinfo
     size max_diss av_diss isolation
[1,]    2       11     5.5 0.1028037
[2,]    1        0     0.0 0.0000000
[3,]    1        0     0.0 0.0000000

$sample
[1] "1"  "2"  "21" "45"

> 
> daisy(ru4, "manhattan")
Dissimilarities :
     1   2  21  22  45  46
2   11                    
21 118 107                
22 124 113   6            
45 143 132  89  87        
46 124 113 108 106  19    
47 115 104 103 101  28   9

Metric :  manhattan 
Number of objects : 7
> ## this one (k=3) gave problems, from ss = 6 on ___ still after 2002-12-28 ___ :
> for(ss in 4:nrow(ru4)){
+     cat("---\n\nsample size = ",ss,"\n")
+     print(clara(ru4,k=3,met="manhattan",sampsize=ss)[clInS])
+ }
---

sample size =  4 
$objective
[1] 7.714286

$i.med
[1] 1 4 7

$medoids
    x   y
1   4  53
22 32 149
47 78  94

$clusinfo
     size max_diss  av_diss  isolation
[1,]    2       11  5.50000 0.09565217
[2,]    2        6  3.00000 0.05940594
[3,]    3       28 12.33333 0.27722772

$sample
[1] "1"  "22" "45" "47"

---

sample size =  5 
$objective
[1] 7.714286

$i.med
[1] 2 3 7

$medoids
    x   y
2   5  63
21 28 147
47 78  94

$clusinfo
     size max_diss  av_diss  isolation
[1,]    2       11  5.50000 0.10576923
[2,]    2        6  3.00000 0.05825243
[3,]    3       28 12.33333 0.27184466

$sample
[1] "2"  "21" "22" "45" "47"

---

sample size =  6 
$objective
[1] 6.428571

$i.med
[1] 2 4 6

$medoids
    x   y
2   5  63
22 32 149
46 85  96

$clusinfo
     size max_diss  av_diss  isolation
[1,]    2       11 5.500000 0.09734513
[2,]    2        6 3.000000 0.05660377
[3,]    3       19 9.333333 0.17924528

$sample
[1] "2"  "21" "22" "45" "46" "47"

---

sample size =  7 
$objective
[1] 6.428571

$i.med
[1] 2 4 6

$medoids
    x   y
2   5  63
22 32 149
46 85  96

$clusinfo
     size max_diss  av_diss  isolation
[1,]    2       11 5.500000 0.09734513
[2,]    2        6 3.000000 0.05660377
[3,]    3       19 9.333333 0.17924528

$sample
[1] "1"  "2"  "21" "22" "45" "46" "47"

> for(ss in 5:nrow(ru3)){
+     cat("---\n\nsample size = ",ss,"\n")
+     print(clara(ru3,k=4,met="manhattan",sampsize=ss)[clInS])
+ }
---

sample size =  5 
$objective
[1] 13.625

$i.med
[1]  4  5 10 15

$medoids
    x   y
4   9  77
21 28 147
45 85 115
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       29   16.50 0.3258427
[2,]    5       14    9.00 0.1573034
[3,]    4       30   19.25 0.3370787
[4,]    3       15   10.00 0.1351351

$sample
[1] "3"  "4"  "21" "45" "62"

---

sample size =  6 
$objective
[1] 9.0625

$i.med
[1]  3  7 13 15

$medoids
    x   y
3  10  59
23 35 153
48 74  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       19   10.00 0.1881188
[2,]    5       13    5.60 0.1354167
[3,]    4       30   11.75 0.3448276
[4,]    3       15   10.00 0.1724138

$sample
[1] "3"  "21" "23" "45" "48" "62"

---

sample size =  7 
$objective
[1] 9.0625

$i.med
[1]  3  7 13 15

$medoids
    x   y
3  10  59
23 35 153
48 74  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       19   10.00 0.1881188
[2,]    5       13    5.60 0.1354167
[3,]    4       30   11.75 0.3448276
[4,]    3       15   10.00 0.1724138

$sample
[1] "2"  "3"  "21" "23" "45" "48" "62"

---

sample size =  8 
$objective
[1] 8.8125

$i.med
[1]  3  7 12 15

$medoids
    x   y
3  10  59
23 35 153
47 78  94
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       19   10.00 0.1844660
[2,]    5       13    5.60 0.1274510
[3,]    4       28   10.75 0.3373494
[4,]    3       15   10.00 0.1807229

$sample
[1] "3"  "21" "23" "46" "47" "48" "61" "62"

---

sample size =  9 
$objective
[1] 9.3125

$i.med
[1]  2  6 11 16

$medoids
    x   y
2   5  63
22 32 149
46 85  96
63 83  21

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1592920
[2,]    5        8    5.40 0.0754717
[3,]    4       19    9.75 0.2467532
[4,]    3       30   15.00 0.3896104

$sample
[1] "2"  "21" "22" "23" "45" "46" "47" "61" "63"

---

sample size =  10 
$objective
[1] 8.5625

$i.med
[1]  3  7 11 15

$medoids
    x   y
3  10  59
23 35 153
46 85  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       19   10.00 0.1696429
[2,]    5       13    5.60 0.1214953
[3,]    4       19    9.75 0.2065217
[4,]    3       15   10.00 0.1630435

$sample
 [1] "2"  "3"  "22" "23" "45" "46" "47" "61" "62" "63"

---

sample size =  11 
$objective
[1] 8.6875

$i.med
[1]  2  7 12 15

$medoids
    x   y
2   5  63
23 35 153
47 78  94
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1730769
[2,]    5       13    5.60 0.1274510
[3,]    4       28   10.75 0.3373494
[4,]    3       15   10.00 0.1807229

$sample
 [1] "1"  "2"  "3"  "4"  "23" "24" "25" "45" "47" "48" "62"

---

sample size =  12 
$objective
[1] 8.8125

$i.med
[1]  3  7 12 15

$medoids
    x   y
3  10  59
23 35 153
47 78  94
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       19   10.00 0.1844660
[2,]    5       13    5.60 0.1274510
[3,]    4       28   10.75 0.3373494
[4,]    3       15   10.00 0.1807229

$sample
 [1] "2"  "3"  "22" "23" "24" "25" "46" "47" "48" "61" "62" "63"

---

sample size =  13 
$objective
[1] 8.4375

$i.med
[1]  2  7 11 15

$medoids
    x   y
2   5  63
23 35 153
46 85  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1592920
[2,]    5       13    5.60 0.1214953
[3,]    4       19    9.75 0.2065217
[4,]    3       15   10.00 0.1630435

$sample
 [1] "1"  "2"  "4"  "22" "23" "24" "25" "45" "46" "47" "61" "62" "63"

---

sample size =  14 
$objective
[1] 8.4375

$i.med
[1]  2  7 11 15

$medoids
    x   y
2   5  63
23 35 153
46 85  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1592920
[2,]    5       13    5.60 0.1214953
[3,]    4       19    9.75 0.2065217
[4,]    3       15   10.00 0.1630435

$sample
 [1] "2"  "3"  "4"  "22" "23" "24" "25" "45" "46" "47" "48" "61" "62" "63"

---

sample size =  15 
$objective
[1] 8.375

$i.med
[1]  2  6 11 15

$medoids
    x   y
2   5  63
22 32 149
46 85  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1592920
[2,]    5        8    5.40 0.0754717
[3,]    4       19    9.75 0.2065217
[4,]    3       15   10.00 0.1630435

$sample
 [1] "2"  "3"  "4"  "21" "22" "23" "24" "25" "45" "46" "47" "48" "61" "62" "63"

---

sample size =  16 
$objective
[1] 8.375

$i.med
[1]  2  6 11 15

$medoids
    x   y
2   5  63
22 32 149
46 85  96
62 77  12

$clusinfo
     size max_diss av_diss isolation
[1,]    4       18    9.50 0.1592920
[2,]    5        8    5.40 0.0754717
[3,]    4       19    9.75 0.2065217
[4,]    3       15   10.00 0.1630435

$sample
 [1] "1"  "2"  "3"  "4"  "21" "22" "23" "24" "25" "45" "46" "47" "48" "61" "62"
[16] "63"

> 
> ## Last Line:
> cat('Time elapsed: ', proc.time() - .proctime00,'\n')
Time elapsed:  1.4 0.013 1.433 0 0 
> ## Lynne (P IV, 1.6 GHz): 18.81; then (no NA; R 1.9.0-alpha): 15.07
> ## nb-mm (P III,700 MHz): 27.97
> 
> proc.time()
   user  system elapsed 
  1.674   0.102   1.917