I read this blog post on R-bloggers and I am confused by the last part of the code and cannot understand.
http://www.r-bloggers.com/self-organising-maps-for-customer-segmentation-using-r/
I tried to recreate this with my own data. I have 5 variables that follow an exponential distribution with 2755 points.
I am doing a great job and can build the map that he creates:
plot(som_model, type="codes")

The section of code that I donβt understand is:
var <- 1 var_unscaled <- aggregate(as.numeric(training[,var]),by=list(som_model$unit.classif),FUN = mean, simplify=TRUE)[,2] plot(som_model, type = "property", property=var_unscaled, main = names(training)[var], palette.name=coolBlueHotRed)
As I understand it, this piece of code, presumably, should display one of the variables above the map to see how it looks, but in this I ran into problems. When I run this section of code, I get a warning:
Warning message: In bgcolors[!is.na(showcolors)] <- bgcol[showcolors[!is.na(showcolors)]] : number of items to replace is not a multiple of replacement length
and he creates a graph:

Which just doesn't look right ...
Now, what I think about, it comes down to how an aggregated function reordered data. The length of var_unscaled is 789, and the length of som_model $, training [, var] and unit.classif is 2755. I tried to build aggregated data, the result was not a warning, but was an incomprehensible graph (as expected).
Now I think this was done because unit.classif has many duplicate numbers inside it and why it reduced the size.
The question is, do I worry about warning? Does it produce an accurate schedule? What is the Property section that the plot command is looking for? Is there any other way to βaggregateβ data?