Rev 7508 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
R version 4.2.0 Patched (2022-05-13 r82353) -- "Vigorous Calisthenics"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-pc-linux-gnu (64-bit)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.> ## For different cluster versions>> require(cluster)Loading required package: cluster>> if(interactive()) print(packageDescription("cluster"))>> ## trivial cases should 'work':> daisy(cbind(1))Dissimilarities :dissimilarity(0)Metric : euclideanNumber of objects : 1> (d10 <- daisy(matrix(0., 1,0))); str(d10)Dissimilarities :dissimilarity(0)Metric : euclideanNumber of objects : 1'dissimilarity' num(0)- attr(*, "Size")= int 1- attr(*, "Metric")= chr "euclidean"> d01 <- daisy(matrix(0., 0,1))> if(paste(R.version$major, R.version$minor, sep=".") >= "2.1.0")+ print(d01)Dissimilarities :dissimilarity(0)Metric : euclideanNumber of objects : 0> str(d01)'dissimilarity' num(0)- attr(*, "Size")= int 0- attr(*, "Metric")= chr "euclidean"> d32 <- data.frame(eins=c("A"=1,"B"=1,"C"=1), zwei=c(2,2,2))> daisy(d32)Dissimilarities :A BB 0C 0 0Metric : euclideanNumber of objects : 3> daisy(d32, stand = TRUE)Dissimilarities :A BB 0C 0 0Metric : euclideanNumber of objects : 3Warning message:In daisy(d32, stand = TRUE) :'x' has constant columns 1, 2; these are standardized to 0> daisy(d32, type = list(ordratio="zwei"))Dissimilarities :A BB 0C 0 0Metric : mixed ; Types = I, TNumber of objects : 3>>> str(d5 <- data.frame(a= c(0, 0, 0,1,0,0, 0,0,1, 0,NA),+ b= c(NA,0, 1,1,0,1, 0,1,0, 1,0),+ c= c(0, 1, 1,0,1,NA,1,0,1, 0,NA),+ d= c(1, 1, 0,1,0,0, 0,0,0, 1,0),+ e= c(1, NA,0,1,0,0, 0,0,NA,1,1)))'data.frame': 11 obs. of 5 variables:$ a: num 0 0 0 1 0 0 0 0 1 0 ...$ b: num NA 0 1 1 0 1 0 1 0 1 ...$ c: num 0 1 1 0 1 NA 1 0 1 0 ...$ d: num 1 1 0 1 0 0 0 0 0 1 ...$ e: num 1 NA 0 1 0 0 0 0 NA 1 ...> (d0 <- daisy(d5))Dissimilarities :1 2 3 4 5 6 7 82 1.2909943 1.936492 1.5811394 1.118034 1.936492 2.0000005 1.936492 1.118034 1.000000 2.2360686 1.825742 1.825742 0.000000 1.936492 1.1180347 1.936492 1.118034 1.000000 2.236068 0.000000 1.1180348 1.581139 1.936492 1.000000 1.732051 1.414214 0.000000 1.4142149 2.236068 1.581139 1.581139 1.936492 1.118034 1.825742 1.118034 1.93649210 0.000000 1.581139 1.732051 1.000000 2.000000 1.581139 2.000000 1.41421411 1.581139 1.581139 1.825742 1.825742 1.290994 1.825742 1.290994 1.8257429 102345678910 2.23606811 0.000000 1.825742Metric : euclideanNumber of objects : 11Warning message:In daisy(d5) : binary variable(s) 1, 2, 3, 4, 5 treated as interval scaled> (d1 <- daisy(d5, type = list(asymm = 1:5)))Dissimilarities :1 2 3 4 5 6 72 0.50000003 1.0000000 0.66666674 0.3333333 0.7500000 0.80000005 1.0000000 0.5000000 0.5000000 1.00000006 1.0000000 1.0000000 0.0000000 0.7500000 1.00000007 1.0000000 0.5000000 0.5000000 1.0000000 0.0000000 1.00000008 1.0000000 1.0000000 0.5000000 0.7500000 1.0000000 0.0000000 1.00000009 1.0000000 0.6666667 0.6666667 0.7500000 0.5000000 1.0000000 0.500000010 0.0000000 0.6666667 0.7500000 0.2500000 1.0000000 0.6666667 1.000000011 0.5000000 1.0000000 1.0000000 0.6666667 1.0000000 1.0000000 1.00000008 9 1023456789 1.000000010 0.6666667 1.000000011 1.0000000 NA 0.6666667Metric : mixed ; Types = A, A, A, A, ANumber of objects : 11> (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5)))Dissimilarities :1 2 3 4 5 6 72 0.33333333 0.7500000 0.50000004 0.3333333 0.7500000 0.80000005 0.7500000 0.2500000 0.3333333 1.00000006 0.6666667 0.6666667 0.0000000 0.7500000 0.50000007 0.7500000 0.2500000 0.3333333 1.0000000 0.0000000 0.50000008 0.6666667 0.7500000 0.3333333 0.7500000 0.6666667 0.0000000 0.66666679 1.0000000 0.5000000 0.6666667 0.7500000 0.3333333 1.0000000 0.333333310 0.0000000 0.5000000 0.6000000 0.2500000 0.8000000 0.5000000 0.800000011 0.5000000 0.5000000 1.0000000 0.6666667 0.5000000 1.0000000 0.50000008 9 1023456789 1.000000010 0.5000000 1.000000011 1.0000000 0.0000000 0.6666667Metric : mixed ; Types = S, S, A, A, ANumber of objects : 11> (d2.<- daisy(d5, type = list( asymm= 3:5)))Dissimilarities :1 2 3 4 5 6 72 0.33333333 0.7500000 0.50000004 0.3333333 0.7500000 0.80000005 0.7500000 0.2500000 0.3333333 1.00000006 0.6666667 0.6666667 0.0000000 0.7500000 0.50000007 0.7500000 0.2500000 0.3333333 1.0000000 0.0000000 0.50000008 0.6666667 0.7500000 0.3333333 0.7500000 0.6666667 0.0000000 0.66666679 1.0000000 0.5000000 0.6666667 0.7500000 0.3333333 1.0000000 0.333333310 0.0000000 0.5000000 0.6000000 0.2500000 0.8000000 0.5000000 0.800000011 0.5000000 0.5000000 1.0000000 0.6666667 0.5000000 1.0000000 0.50000008 9 1023456789 1.000000010 0.5000000 1.000000011 1.0000000 0.0000000 0.6666667Metric : mixed ; Types = I, I, A, A, ANumber of objects : 11Warning message:In daisy(d5, type = list(asymm = 3:5)) :binary variable(s) 1, 2 treated as interval scaled> stopifnot(identical(c(d2), c(d2.)))> (dS <- daisy(d5, stand = TRUE))# gave error in some versionsDissimilarities :1 2 3 4 5 6 7 82 2.6142643 4.010913 3.2917864 3.493856 4.725761 4.7576845 4.010913 2.415752 2.000000 5.1609656 3.823025 3.801028 0.000000 4.813384 2.2360687 4.010913 2.415752 2.000000 5.160965 0.000000 2.2360688 3.310837 3.995202 2.025000 4.305222 2.846160 0.000000 2.8461609 5.558018 4.247692 4.148136 3.995202 3.493856 4.789855 3.493856 4.72576110 0.000000 3.182103 3.587469 3.125000 4.107303 3.310837 4.107303 2.96130211 3.416389 3.416389 3.674376 3.801028 2.614264 3.674376 2.614264 3.6743769 102345678910 5.30741711 0.000000 3.801028Metric : euclideanNumber of objects : 11Warning message:In daisy(d5, stand = TRUE) :binary variable(s) 1, 2, 3, 4, 5 treated as interval scaled> stopifnot(all.equal(as.vector(summary(c(dS), digits=9)),+ c(0, 2.6142638, 3.4938562, 3.2933687, 4.0591077, 5.5580177),+ tol = 1e-7))# 7.88e-9>> d5[,4] <- 1 # binary with only one instead of two values> (d0 <- daisy(d5))Dissimilarities :1 2 3 4 5 6 7 82 1.2909943 1.581139 1.1180344 1.118034 1.936492 1.7320515 1.581139 0.000000 1.000000 2.0000006 1.290994 1.290994 0.000000 1.581139 1.1180347 1.581139 0.000000 1.000000 2.000000 0.000000 1.1180348 1.118034 1.581139 1.000000 1.414214 1.414214 0.000000 1.4142149 1.825742 1.118034 1.581139 1.581139 1.118034 1.825742 1.118034 1.93649210 0.000000 1.581139 1.414214 1.000000 1.732051 1.118034 1.732051 1.00000011 0.000000 0.000000 1.825742 1.290994 1.290994 1.825742 1.290994 1.8257429 102345678910 1.93649211 0.000000 1.290994Metric : euclideanNumber of objects : 11Warning message:In daisy(d5) : binary variable(s) 1, 2, 3, 5 treated as interval scaled> (d1 <- daisy(d5, type = list(asymm = 1:5)))# 2 NAsDissimilarities :1 2 3 4 5 6 72 1.00000003 1.0000000 0.50000004 0.5000000 1.0000000 0.75000005 1.0000000 0.0000000 0.5000000 1.00000006 1.0000000 1.0000000 0.0000000 0.6666667 1.00000007 1.0000000 0.0000000 0.5000000 1.0000000 0.0000000 1.00000008 1.0000000 1.0000000 0.5000000 0.6666667 1.0000000 0.0000000 1.00000009 1.0000000 0.5000000 0.6666667 0.6666667 0.5000000 1.0000000 0.500000010 0.0000000 1.0000000 0.6666667 0.3333333 1.0000000 0.5000000 1.000000011 0.0000000 NA 1.0000000 0.5000000 1.0000000 1.0000000 1.00000008 9 1023456789 1.000000010 0.5000000 1.000000011 1.0000000 NA 0.5000000Metric : mixed ; Types = A, A, A, A, ANumber of objects : 11Warning message:In daisy(d5, type = list(asymm = 1:5)) :at least one binary variable has not 2 different levels.> (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5)))Dissimilarities :1 2 3 4 5 6 72 0.50000003 0.6666667 0.33333334 0.5000000 1.0000000 0.75000005 0.6666667 0.0000000 0.3333333 1.00000006 0.5000000 0.5000000 0.0000000 0.6666667 0.50000007 0.6666667 0.0000000 0.3333333 1.0000000 0.0000000 0.50000008 0.5000000 0.6666667 0.3333333 0.6666667 0.6666667 0.0000000 0.66666679 1.0000000 0.3333333 0.6666667 0.6666667 0.3333333 1.0000000 0.333333310 0.0000000 0.6666667 0.5000000 0.3333333 0.7500000 0.3333333 0.750000011 0.0000000 0.0000000 1.0000000 0.5000000 0.5000000 1.0000000 0.50000008 9 1023456789 1.000000010 0.3333333 1.000000011 1.0000000 0.0000000 0.5000000Metric : mixed ; Types = S, S, A, A, ANumber of objects : 11Warning message:In daisy(d5, type = list(symm = 1:2, asymm = 3:5)) :at least one binary variable has not 2 different levels.> (d2.<- daisy(d5, type = list( asymm= 3:5)))Dissimilarities :1 2 3 4 5 6 72 0.50000003 0.6666667 0.33333334 0.5000000 1.0000000 0.75000005 0.6666667 0.0000000 0.3333333 1.00000006 0.5000000 0.5000000 0.0000000 0.6666667 0.50000007 0.6666667 0.0000000 0.3333333 1.0000000 0.0000000 0.50000008 0.5000000 0.6666667 0.3333333 0.6666667 0.6666667 0.0000000 0.66666679 1.0000000 0.3333333 0.6666667 0.6666667 0.3333333 1.0000000 0.333333310 0.0000000 0.6666667 0.5000000 0.3333333 0.7500000 0.3333333 0.750000011 0.0000000 0.0000000 1.0000000 0.5000000 0.5000000 1.0000000 0.50000008 9 1023456789 1.000000010 0.3333333 1.000000011 1.0000000 0.0000000 0.5000000Metric : mixed ; Types = I, I, A, A, ANumber of objects : 11Warning messages:1: In daisy(d5, type = list(asymm = 3:5)) :at least one binary variable has not 2 different levels.2: In daisy(d5, type = list(asymm = 3:5)) :binary variable(s) 1, 2 treated as interval scaled> ## better leave away the constant variable: it has no effect:> stopifnot(identical(c(d1), c(daisy(d5[,-4], type = list(asymm = 1:4)))))>> ###---- Trivial "binary only" matrices (not data frames) did fail:>> x <- matrix(0, 2, 2)> dimnames(x)[[2]] <- c("A", "B")## colnames<- is missing in S+> daisy(x, type = list(symm= "B", asymm="A"))Dissimilarities :12 0Metric : mixed ; Types = A, SNumber of objects : 2Warning message:In daisy(x, type = list(symm = "B", asymm = "A")) :at least one binary variable has not 2 different levels.> daisy(x, type = list(symm= "B"))# 0 tooDissimilarities :12 0Metric : mixed ; Types = I, SNumber of objects : 2Warning message:In daisy(x, type = list(symm = "B")) :at least one binary variable has not 2 different levels.>> x2 <- x; x2[2,2] <- 1> daisy(x2, type= list(symm = "B"))# |-> 0.5 (gives 1 in S+)Dissimilarities :12 0.5Metric : mixed ; Types = I, SNumber of objects : 2> daisy(x2, type= list(symm = "B", asymm="A"))# 1Dissimilarities :12 1Metric : mixed ; Types = A, SNumber of objects : 2Warning message:In daisy(x2, type = list(symm = "B", asymm = "A")) :at least one binary variable has not 2 different levels.>> x3 <- x; x3[] <- diag(2)> daisy(x3) # warning: both as interval scaled -> sqrt(2)Dissimilarities :12 1.414214Metric : euclideanNumber of objects : 2> daisy(x3, type= list(symm="B", asymm="A"))# 1Dissimilarities :12 1Metric : mixed ; Types = A, SNumber of objects : 2> daisy(x3, type= list(symm =c("B","A"))) # 1, S+: sqrt(2)Dissimilarities :12 1Metric : mixed ; Types = S, SNumber of objects : 2> daisy(x3, type= list(asymm=c("B","A"))) # 1, S+ : sqrt(2)Dissimilarities :12 1Metric : mixed ; Types = A, ANumber of objects : 2>> x4 <- rbind(x3, 1)> daisy(x4, type= list(symm="B", asymm="A"))# 1 0.5 0.5Dissimilarities :1 22 1.03 0.5 0.5Metric : mixed ; Types = A, SNumber of objects : 3> daisy(x4, type= list(symm=c("B","A"))) # dito; S+ : 1.41 1 1Dissimilarities :1 22 1.03 0.5 0.5Metric : mixed ; Types = S, SNumber of objects : 3> daisy(x4, type= list(asymm=c("A","B"))) # dito, ditoDissimilarities :1 22 1.03 0.5 0.5Metric : mixed ; Types = A, ANumber of objects : 3>>>> ## ----------- example(daisy) ----------------------->> data(flower)> data(agriculture)>> ## Example 1 in ref:> ## Dissimilarities using Euclidean metric and without standardization> (d.agr <- daisy(agriculture, metric = "euclidean", stand = FALSE))Dissimilarities :B DK D GR E F IRLDK 5.408327D 2.061553 3.405877GR 22.339651 22.570113 22.661200E 9.818350 11.182576 10.394710 12.567418F 3.448188 3.512834 2.657066 20.100995 8.060397IRL 12.747549 13.306014 13.080138 9.604166 3.140064 10.564563I 5.803447 5.470832 5.423099 17.383325 5.727128 2.773085 7.920859L 4.275512 2.220360 2.300000 24.035391 12.121056 4.060788 14.569145NL 1.649242 5.096077 2.435159 20.752349 8.280097 2.202272 11.150785P 17.236299 17.864490 17.664088 5.162364 7.430343 15.164432 4.601087UK 2.828427 8.052950 4.850773 21.485344 8.984431 5.303772 12.103718I L NL PDKDGREFIRLIL 6.660330NL 4.204759 4.669047P 12.515990 19.168985 15.670673UK 6.723095 7.102112 3.124100 16.323296Metric : euclideanNumber of objects : 12> (d.agr2 <- daisy(agriculture, metric = "manhattan"))Dissimilarities :B DK D GR E F IRL I L NL PDK 7.5D 2.7 4.8GR 30.4 31.9 31.5E 13.6 15.1 14.7 16.8F 4.3 3.8 3.4 28.1 11.3IRL 17.2 18.7 18.3 13.2 3.6 14.9I 6.0 7.5 7.1 24.4 7.6 3.7 11.2L 5.0 2.5 2.3 33.8 17.0 5.7 20.6 9.4NL 2.0 6.3 3.1 28.4 11.6 3.1 15.2 4.4 5.4P 23.7 25.2 24.8 6.7 10.1 21.4 6.5 17.7 27.1 21.7UK 3.2 10.7 5.9 28.0 11.2 7.5 14.8 8.8 8.2 4.4 21.3Metric : manhattanNumber of objects : 12>>> ## Example 2 in ref> (dfl0 <- daisy(flower))Dissimilarities :1 2 3 4 5 6 72 0.88754083 0.5272467 0.51470594 0.3517974 0.5504493 0.56515525 0.4115605 0.6226307 0.3726307 0.63835786 0.2269199 0.6606209 0.3003268 0.4189951 0.34436277 0.2876225 0.5999183 0.4896242 0.3435866 0.4197712 0.18929748 0.4234069 0.4641340 0.6038399 0.2960376 0.4673203 0.5714869 0.41078439 0.5808824 0.4316585 0.4463644 0.8076797 0.3306781 0.5136846 0.589093110 0.6094363 0.4531046 0.4678105 0.5570670 0.3812908 0.4119281 0.586519611 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.565236912 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.639134013 0.5196487 0.5248366 0.5395425 0.7464461 0.2919118 0.4524510 0.527859514 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.504983715 0.6221814 0.3903595 0.5300654 0.5531454 0.4602124 0.5091503 0.334558816 0.6935866 0.3575163 0.6222222 0.3417892 0.7301471 0.5107843 0.435375817 0.7765114 0.1904412 0.5801471 0.4247141 0.6880719 0.5937092 0.518300718 0.4610294 0.4515114 0.7162173 0.4378268 0.4755310 0.6438317 0.46924028 9 10 11 12 13 1423456789 0.636642210 0.6639706 0.425612711 0.4955474 0.4308007 0.394812112 0.4216503 0.4194036 0.3812092 0.263602913 0.5754085 0.2181781 0.3643791 0.3445670 0.233169914 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.378431415 0.4512255 0.2545343 0.4210784 0.4806781 0.4295752 0.3183007 0.435130716 0.6378268 0.6494690 0.3488562 0.7436683 0.6050654 0.5882353 0.459803917 0.4707516 0.6073938 0.3067810 0.7015931 0.5629902 0.5461601 0.542728818 0.1417892 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.569812115 16 172345678910111213141516 0.394934617 0.3528595 0.167075218 0.5096814 0.7796160 0.6125408Metric : mixed ; Types = N, N, N, N, O, O, I, INumber of objects : 18> stopifnot(identical(c(dfl0),+ c(daisy(flower, type = list(symm = 1)))) &&+ identical(c(dfl0),+ c(daisy(flower, type = list(symm = 2)))) &&+ identical(c(dfl0),+ c(daisy(flower, type = list(symm = 3)))) &&+ identical(c(dfl0),+ c(daisy(flower, type = list(symm = c(1,3)))))+ )>> (dfl1 <- daisy(flower, type = list(asymm = 3)))Dissimilarities :1 2 3 4 5 6 72 0.88754083 0.5272467 0.58823534 0.3517974 0.5504493 0.56515525 0.4115605 0.7115780 0.4258637 0.63835786 0.2269199 0.7549953 0.3432306 0.4189951 0.39355747 0.2876225 0.6856209 0.5595705 0.3435866 0.4797386 0.21633998 0.4234069 0.4641340 0.6038399 0.2960376 0.4673203 0.5714869 0.41078439 0.5808824 0.4933240 0.5101307 0.8076797 0.3779178 0.5870682 0.673249310 0.6094363 0.5178338 0.5346405 0.5570670 0.4357610 0.4707750 0.670308111 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.565236912 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.639134013 0.5196487 0.5998133 0.6166200 0.7464461 0.3336134 0.5170868 0.603268014 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.504983715 0.6221814 0.4461251 0.6057890 0.5531454 0.5259570 0.5818861 0.382352916 0.6935866 0.4085901 0.7111111 0.3417892 0.8344538 0.5837535 0.497572417 0.7765114 0.2176471 0.6630252 0.4247141 0.7863679 0.6785247 0.592343618 0.4610294 0.4515114 0.7162173 0.4378268 0.4755310 0.6438317 0.46924028 9 10 11 12 13 1423456789 0.636642210 0.6639706 0.486414611 0.4955474 0.4308007 0.394812112 0.4216503 0.4194036 0.3812092 0.263602913 0.5754085 0.2493464 0.4164332 0.3445670 0.233169914 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.378431415 0.4512255 0.2908964 0.4812325 0.4806781 0.4295752 0.3637722 0.435130716 0.6378268 0.7422502 0.3986928 0.7436683 0.6050654 0.6722689 0.459803917 0.4707516 0.6941643 0.3506069 0.7015931 0.5629902 0.6241830 0.542728818 0.1417892 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.569812115 16 172345678910111213141516 0.451353917 0.4032680 0.190943018 0.5096814 0.7796160 0.6125408Metric : mixed ; Types = N, N, A, N, O, O, I, INumber of objects : 18> (dfl2 <- daisy(flower, type = list(asymm = c(1, 3), ordratio = 7)))Dissimilarities :1 2 3 4 5 6 72 0.90073533 0.6176471 0.58823534 0.4226891 0.5455882 0.64033615 0.4806723 0.7369748 0.5264706 0.76050426 0.2823529 0.7470588 0.3911765 0.4764706 0.49803927 0.3310924 0.6983193 0.6676471 0.4109244 0.5745098 0.27647068 0.5100840 0.4544118 0.6789916 0.3327731 0.5705882 0.6563025 0.49327739 0.5808824 0.5084034 0.5252101 0.8257353 0.3882353 0.6100840 0.675630310 0.6323529 0.5067227 0.5235294 0.5522059 0.4722689 0.4739496 0.694117611 0.3389706 0.7117647 0.6014706 0.6588235 0.4066176 0.4919118 0.574264712 0.4441176 0.5816176 0.5963235 0.5139706 0.5264706 0.5220588 0.654411813 0.5286765 0.6252101 0.6420168 0.7735294 0.3336134 0.5504202 0.615966414 0.3044118 0.5963235 0.6110294 0.3742647 0.5411765 0.3573529 0.514705915 0.6242647 0.4588235 0.6184874 0.5691176 0.5386555 0.6025210 0.382352916 0.6845588 0.3831933 0.6857143 0.3147059 0.8344538 0.5504202 0.484873917 0.7897059 0.2176471 0.6630252 0.4198529 0.8117647 0.6705882 0.605042018 0.5268908 0.4647059 0.8336134 0.5210084 0.5537815 0.7588235 0.53865558 9 10 11 12 13 1423456789 0.659558810 0.6639706 0.512605011 0.5073529 0.4419118 0.406617612 0.4272059 0.4367647 0.3867647 0.269852913 0.6073529 0.2596639 0.4529412 0.3647059 0.259558814 0.4669118 0.4514706 0.3720588 0.2845588 0.1647059 0.399264715 0.4720588 0.2932773 0.5050420 0.4897059 0.4448529 0.3764706 0.444852916 0.6058824 0.7319328 0.3621849 0.7235294 0.5786765 0.6722689 0.438970617 0.4610294 0.7092437 0.3394958 0.7036765 0.5588235 0.6495798 0.544117618 0.1882353 0.5198529 0.8286765 0.5470588 0.5669118 0.5823529 0.581617615 16 172345678910111213141516 0.438655517 0.4159664 0.165546218 0.5117647 0.7705882 0.6257353Metric : mixed ; Types = A, N, A, N, O, O, T, INumber of objects : 18> (dfl3 <- daisy(flower, type = list(asymm = 1:3)))Dissimilarities :1 2 3 4 5 6 72 0.88754083 0.6025677 0.58823534 0.4020542 0.6290850 0.64589175 0.4703548 0.7115780 0.4968410 0.72955186 0.2593371 0.7549953 0.4004357 0.4788515 0.45915037 0.3287115 0.7998911 0.6528322 0.4581155 0.5596950 0.25239658 0.4838936 0.5304388 0.6901027 0.3947168 0.5340803 0.6531279 0.54771249 0.5808824 0.4933240 0.5101307 0.8076797 0.3779178 0.5870682 0.673249310 0.6094363 0.5178338 0.5346405 0.5570670 0.4357610 0.4707750 0.670308111 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.565236912 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.639134013 0.5196487 0.5998133 0.6166200 0.7464461 0.3336134 0.5170868 0.603268014 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.504983715 0.6221814 0.5204793 0.6057890 0.6321662 0.5259570 0.5818861 0.446078416 0.6935866 0.4766885 0.7111111 0.3906162 0.8344538 0.5837535 0.580501117 0.7765114 0.2539216 0.6630252 0.4853875 0.7863679 0.6785247 0.691067518 0.5268908 0.5160131 0.8185341 0.5837691 0.5434641 0.7358077 0.62565368 9 10 11 12 13 1423456789 0.636642210 0.6639706 0.486414611 0.4955474 0.4308007 0.394812112 0.4216503 0.4194036 0.3812092 0.263602913 0.5754085 0.2493464 0.4164332 0.3445670 0.233169914 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.378431415 0.5156863 0.2908964 0.4812325 0.4806781 0.4295752 0.3637722 0.435130716 0.7289449 0.7422502 0.3986928 0.7436683 0.6050654 0.6722689 0.459803917 0.5380019 0.6941643 0.3506069 0.7015931 0.5629902 0.6241830 0.542728818 0.1890523 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.569812115 16 172345678910111213141516 0.526579517 0.4704793 0.222766918 0.5824930 0.8909897 0.7000467Metric : mixed ; Types = A, A, A, N, O, O, I, INumber of objects : 18>> ## --- animals> data(animals)> d0 <- daisy(animals)Warning message:In daisy(animals) :binary variable(s) 1, 2, 3, 4, 5, 6 treated as interval scaled>> d1 <- daisy(animals - 1, type=list(asymm=c(2,4)))Warning message:In daisy(animals - 1, type = list(asymm = c(2, 4))) :binary variable(s) 1, 3, 5, 6 treated as interval scaled> (d2 <- daisy(animals - 1, type=list(symm = c(1,3,5,6), asymm=c(2,4))))Dissimilarities :ant bee cat cpl chi cow ducbee 0.4000000cat 1.0000000 0.8000000cpl 0.5000000 0.4000000 0.5000000chi 0.8000000 0.6666667 0.4000000 0.8000000cow 0.7500000 0.6000000 0.2500000 0.7500000 0.2000000duc 0.6000000 0.6000000 0.6000000 1.0000000 0.5000000 0.4000000eag 0.8333333 0.8333333 0.5000000 0.8333333 0.5000000 0.6666667 0.3333333ele 0.6000000 0.8333333 0.6000000 1.0000000 0.2000000 0.4000000 0.3333333fly 0.4000000 0.4000000 0.8000000 0.4000000 1.0000000 1.0000000 0.6000000fro 0.5000000 0.8000000 0.7500000 0.7500000 0.5000000 0.7500000 0.6000000her 0.2500000 0.6000000 0.7500000 0.7500000 0.6000000 0.5000000 0.4000000lio 0.7500000 0.6000000 0.2500000 0.7500000 0.0000000 0.0000000 0.4000000liz 0.5000000 0.8000000 0.5000000 0.5000000 0.8000000 0.7500000 0.6000000lob 0.0000000 0.5000000 1.0000000 0.3333333 1.0000000 1.0000000 0.7500000man 0.8000000 0.6666667 0.4000000 0.8000000 0.0000000 0.2000000 0.5000000rab 0.7500000 0.6000000 0.2500000 0.7500000 0.2000000 0.0000000 0.4000000sal 0.3333333 0.7500000 0.6666667 0.6666667 0.7500000 0.6666667 0.5000000spi 0.5000000 0.4000000 0.5000000 0.0000000 0.7500000 0.7500000 1.0000000wha 0.6000000 0.8333333 0.6000000 1.0000000 0.2000000 0.4000000 0.3333333eag ele fly fro her lio lizbeecatcplchicowduceagele 0.3333333fly 0.5000000 0.8333333fro 0.4000000 0.2500000 0.6000000her 0.6666667 0.4000000 0.6000000 0.2500000lio 0.6000000 0.2500000 1.0000000 0.6666667 0.5000000liz 0.5000000 0.6000000 0.4000000 0.2500000 0.2500000 0.7500000lob 0.8000000 0.7500000 0.2500000 0.5000000 0.3333333 1.0000000 0.3333333man 0.5000000 0.2000000 1.0000000 0.5000000 0.6000000 0.0000000 0.8000000rab 0.6666667 0.4000000 1.0000000 0.7500000 0.5000000 0.0000000 0.7500000sal 0.6000000 0.5000000 0.5000000 0.2500000 0.0000000 0.6666667 0.0000000spi 0.8000000 1.0000000 0.4000000 0.6666667 0.7500000 0.7500000 0.5000000wha 0.3333333 0.0000000 0.8333333 0.2500000 0.4000000 0.2500000 0.6000000lob man rab sal spibeecatcplchicowduceageleflyfroherliolizlobman 1.0000000rab 1.0000000 0.2000000sal 0.3333333 0.7500000 0.6666667spi 0.3333333 0.7500000 0.7500000 0.6666667wha 0.7500000 0.2000000 0.4000000 0.5000000 1.0000000Metric : mixed ; Types = S, A, S, A, S, SNumber of objects : 20> stopifnot(c(d1) == c(d2))>> d3 <- daisy(2 - animals, type=list(asymm=c(2,4)))Warning message:In daisy(2 - animals, type = list(asymm = c(2, 4))) :binary variable(s) 1, 3, 5, 6 treated as interval scaled> (d4 <- daisy(2 - animals, type=list(symm = c(1,3,5,6), asymm=c(2,4))))Dissimilarities :ant bee cat cpl chi cow ducbee 0.3333333cat 0.6666667 0.6666667cpl 0.3333333 0.3333333 0.3333333chi 0.6666667 0.6666667 0.3333333 0.6666667cow 0.5000000 0.5000000 0.1666667 0.5000000 0.1666667duc 0.5000000 0.6000000 0.5000000 0.8333333 0.5000000 0.3333333eag 0.8333333 1.0000000 0.5000000 0.8333333 0.6000000 0.6666667 0.4000000ele 0.5000000 0.8333333 0.5000000 0.8333333 0.2000000 0.3333333 0.3333333fly 0.3333333 0.4000000 0.6666667 0.3333333 1.0000000 0.8333333 0.6000000fro 0.4000000 0.8000000 0.6000000 0.6000000 0.5000000 0.6000000 0.6000000her 0.1666667 0.5000000 0.5000000 0.5000000 0.5000000 0.3333333 0.3333333lio 0.6000000 0.6000000 0.2000000 0.6000000 0.0000000 0.0000000 0.4000000liz 0.3333333 0.6666667 0.3333333 0.3333333 0.6666667 0.5000000 0.5000000lob 0.0000000 0.4000000 0.6000000 0.2000000 0.8000000 0.6000000 0.6000000man 0.6666667 0.6666667 0.3333333 0.6666667 0.0000000 0.1666667 0.5000000rab 0.5000000 0.5000000 0.1666667 0.5000000 0.1666667 0.0000000 0.3333333sal 0.2000000 0.6000000 0.4000000 0.4000000 0.6000000 0.4000000 0.4000000spi 0.4000000 0.4000000 0.4000000 0.0000000 0.6000000 0.6000000 1.0000000wha 0.5000000 0.8333333 0.5000000 0.8333333 0.2000000 0.3333333 0.3333333eag ele fly fro her lio lizbeecatcplchicowduceagele 0.4000000fly 0.6000000 0.8333333fro 0.5000000 0.2500000 0.6000000her 0.6666667 0.3333333 0.5000000 0.2000000lio 0.6000000 0.2000000 1.0000000 0.5000000 0.4000000liz 0.5000000 0.5000000 0.3333333 0.2000000 0.1666667 0.6000000lob 0.8000000 0.6000000 0.2000000 0.4000000 0.2000000 0.7500000 0.2000000man 0.6000000 0.2000000 1.0000000 0.5000000 0.5000000 0.0000000 0.6666667rab 0.6666667 0.3333333 0.8333333 0.6000000 0.3333333 0.0000000 0.5000000sal 0.6000000 0.4000000 0.4000000 0.2000000 0.0000000 0.5000000 0.0000000spi 0.8000000 0.8000000 0.4000000 0.5000000 0.6000000 0.6000000 0.4000000wha 0.4000000 0.0000000 0.8333333 0.2500000 0.3333333 0.2000000 0.5000000lob man rab sal spibeecatcplchicowduceageleflyfroherliolizlobman 0.8000000rab 0.6000000 0.1666667sal 0.2000000 0.6000000 0.4000000spi 0.2500000 0.6000000 0.6000000 0.5000000wha 0.6000000 0.2000000 0.3333333 0.4000000 0.8000000Metric : mixed ; Types = S, A, S, A, S, SNumber of objects : 20> stopifnot(c(d3) == c(d4))>> pairs(cbind(d0,d2,d4),+ main = "Animals -- symmetric and asymm. dissimilarities")>> proc.time()user system elapsed0.518 0.113 0.905