library(kohonen)
data("wines")
head(wines)
##      alcohol malic acid  ash ash alkalinity magnesium tot. phenols flavonoids
## [1,]   13.20       1.78 2.14           11.2       100         2.65       2.76
## [2,]   13.16       2.36 2.67           18.6       101         2.80       3.24
## [3,]   14.37       1.95 2.50           16.8       113         3.85       3.49
## [4,]   13.24       2.59 2.87           21.0       118         2.80       2.69
## [5,]   14.20       1.76 2.45           15.2       112         3.27       3.39
## [6,]   14.39       1.87 2.45           14.6        96         2.50       2.52
##      non-flav. phenols proanth col. int. col. hue OD ratio proline
## [1,]              0.26    1.28      4.38     1.05     3.40    1050
## [2,]              0.30    2.81      5.68     1.03     3.17    1185
## [3,]              0.24    2.18      7.80     0.86     3.45    1480
## [4,]              0.39    1.82      4.32     1.04     2.93     735
## [5,]              0.34    1.97      6.75     1.05     2.85    1450
## [6,]              0.30    1.98      5.25     1.02     3.58    1290
set.seed(7)
wine.som<-som(scale(wines))
grid = somgrid(5,4, "hexagonal")
summary(wine.som)
## SOM of size 8x6 with a rectangular topology and a bubble neighbourhood function.
## The number of data layers is 1.
## Distance measure(s) used: sumofsquares.
## Training data included: 177 objects.
## Mean distance to the closest unit in the map: 2.711.
plot(wine.som, main="wine data")