Hi Mohamed, checked it out.

You’re right, the part of the code was missing: synthetic.customers.cl is the original dataframe + a column with clusters assigned.

Just add this before the code block, should fix it:

clust.num <- cutree(aggl.clust.c, k = 7)

synthetic.customers.cl <- cbind(synthetic.customers, clust.num)

Tell me if it works!

Data Lab | Growth Hacking & Data Science

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store