'Clustering of one variable based on another variable

I would like to make clusters of different countries based on their GDP per capita. In our example, we use the GDP per capita for each year and have different years represented in our dataset.

How can we cluster these countries easily in R?

picture of database



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source