data(wines)
set.seed(7)
training <- sample(nrow(wines), 150)
Xtraining <- scale(wines[training, ])
somnet <- som(Xtraining, somgrid(5, 5, "hexagonal"))
map(somnet,
scale(wines[-training, ],
center=attr(Xtraining, "scaled:center"),
scale=attr(Xtraining, "scaled:scale")))
Run the code above in your browser using DataLab