Question: I need to work with a hashtable which values can store variables like:

* `$numberOfItems`
* `$ItemsNames`

If I ain't wrong, that would mean another hash like array as value.

What should be the right syntax for inserting and iterating over it?

Is anything like:

```
$hash['anyKey']=>$numberOfItems=15;
$hash['anyKey']=>$ItemsNames=['f','fw'];

```

valid?

Answer: 
You could use a PERMANOVA to partition the euclidean distance by your groups:

```
data(iris)
require(vegan)

# PCA
iris_c <- scale(iris[ ,1:4])
pca <- rda(iris_c)

# plot
plot(pca, type = 'n', display = 'sites')
cols <- c('red', 'blue', 'green')
points(pca, display='sites', col = cols[iris$Species], pch = 16)
ordihull(pca, groups=iris$Species)
ordispider(pca, groups = iris$Species, label = TRUE)

# PerMANOVA - partitioning the euclidean distance matrix by species
adonis(iris_c ~ Species, data = iris, method='eu')

```
I have found two distances to represent what you see on a PCA plot into numbers.

Mahalanobis distance:

```
require(HDMD)
md<-pairwise.mahalanobis(iris[,1:4],grouping=iris$Species)
md$distance 

         [,1]     [,2]      [,3]
[1,]   0.0000 91.65640 178.01916
[2,]  91.6564  0.00000  14.52879
[3,] 178.0192 14.52879   0.00000

```

Bhattacharyya distance:

```
require(fpc)
require(gtools)
lst<-split(iris[,1:4],iris$Species)

mat1<-lst[[1]]
mat2<-lst[[2]]
bd1<-bhattacharyya.dist(colMeans(mat1),colMeans(mat2),cov(mat1),cov(mat2))

mat1<-lst[[1]]
mat2<-lst[[3]]
bd2<-bhattacharyya.dist(colMeans(mat1),colMeans(mat2),cov(mat1),cov(mat2))

mat1<-lst[[2]]
mat2<-lst[[3]]
bd3<-bhattacharyya.dist(colMeans(mat1),colMeans(mat2),cov(mat1),cov(mat2))

dat<-as.data.frame(combinations(length(names(lst)),2,names(lst)))
dat$bd<-c(bd1,bd2,bd3)
dat

          V1         V2        bd
1     setosa versicolor 13.260705
2     setosa  virginica 24.981436
3 versicolor  virginica  1.964323

```

To measure significance between clusters

```
require(ICSNP)
HotellingsT2(mat1,mat2,test="f")

```