I am conducting a data analysis on some data in R. I discovered self-organizing maps (SOM) and it seems quite good to depict the link among the data. I tried both "kohonen" and "som" libraries. However, I am not able to map my data onto the created SOM. For instance, here is a picture I found in a SOM tutorial where the data (here, countries) are mapped onto the SOM. I can not figure out either how to extract information about the different nodes from a SOM object created by one of the two libraries listed above.
Does someone know how to do it ?
EDIT:
Some data and code example (using the "kohonen" package):
library(kohonen)
# wines = a dataset from kohonen library. It has 76 examples with 13 criteria.
som_grid <- somgrid(xdim=5, ydim=5, topo="hexagonal")
som_model <- som(wines, grid=som_grid)
plot(som_model)
This code shows the number of items in each node of the SOM:
plot(som_model,type="counts",palette.name=coolBlueHotRed)
If we want to see the value of the first criteria for all nodes of the SOM:
var <- 1
var_unscaled <- aggregate(as.numeric(wines[,var]),by=list(som_model$unit.classif),FUN=mean,simplify=TRUE)[,2]
plot(som_model,type="property",property=var_unscaled,main=names(wines)[var])
I would like to create a map like the first image, meaning a SOM with the name of each variable mapped to the closest node of the SOM.