Running examples in ‘kohonen-Ex.R’ failed
The error most likely occurred in:

> ### Name: predict.kohonen
> ### Title: Predict properties using a trained Kohonen map
> ### Aliases: predict.kohonen
> ### Keywords: classif
> 
> ### ** Examples
> 
> data(wines)
> 
> training <- sample(nrow(wines), 120)
> Xtraining <- scale(wines[training, ])
> Xtest <- scale(wines[-training, ],
+                center = attr(Xtraining, "scaled:center"),
+                scale = attr(Xtraining, "scaled:scale"))
> trainingdata <- list(measurements = Xtraining,
+                      vintages = vintages[training])
> testdata <- list(measurements = Xtest, vintages = vintages[-training])
> 
> mygrid = somgrid(5, 5, "hexagonal")
> som.wines <- supersom(trainingdata, grid = mygrid)
> 
> ## ################################################################
> ## Situation 0: obtain expected values for training data (all layers,
> ## also if not used in training) on the basis of the position in the map
> som.prediction <- predict(som.wines)
> 
> ## ################################################################
> ## Situation 1: obtain predictions for all layers used in training
> 
> som.prediction <- predict(som.wines, newdata = testdata)
> table(vintages[-training], som.prediction$predictions[["vintages"]])
            
             Barbera Barolo Grignolino
  Barbera         11      0          0
  Barolo           0     21          0
  Grignolino       0      0         25
> 
> 
> ## ################################################################
> ## Situation 2: obtain predictions for the vintage based on the mapping
> ## of the sample characteristics only. There are several ways of doing this:
> 
> som.prediction <- predict(som.wines, newdata = testdata,
+                           whatmap = "measurements")
> table(vintages[-training], som.prediction$predictions[["vintages"]])
            
             Barbera Barolo Grignolino
  Barbera         11      0          0
  Barolo           0     21          0
  Grignolino       0      1         21
> 
> ## same, but now indicated implicitly
> som.prediction <- predict(som.wines, newdata = testdata[1])
> table(vintages[-training], som.prediction$predictions[["vintages"]])
            
             Barbera Barolo Grignolino
  Barbera         11      0          0
  Barolo           0     21          0
  Grignolino       0      1         21
> 
> ## if no names are present in the list elements whatmap needs to be
> ## given explicitly; note that the order of the data layers needs to be
> ## consistent with the kohonen object
> som.prediction <- predict(som.wines, newdata = list(Xtest), whatmap = 1)
> table(vintages[-training], som.prediction$predictions[["vintages"]])
            
             Barbera Barolo Grignolino
  Barbera         11      0          0
  Barolo           0     21          0
  Grignolino       0      1         21
> 
> 
> ## ###############################################################
> ## Situation 3: predictions for layers not present in the original
> ## data. Training data need to be provided for those layers.
> som.wines <- supersom(Xtraining, grid = mygrid)
> som.prediction <- predict(som.wines, newdata = testdata,
+                           trainingdata = trainingdata)
Error in check.whatmap(newdata, whatmap.new) : incorrect whatmap argument
Calls: predict -> predict.kohonen -> check.whatmap
Execution halted