Solution to the clustering exercise

This solution assumes that you already have the data shap ready, and that the cluster and scatterplot3d packages are loaded.
agn=agnes(shap,method='complete')
classes = cutree(as.hclust(agn),k=5)
colors = c("red","green","blue","black","pink")
scatterplot3d(shap,color=colors[classes])
Incidentally, this solution shows how you can choose your own colors. Most of the time you won't care about the colors, except that they should be different for the different classes. In that case we may use
scatterplot3d(shap,color=classes) #R will choose the colors