Book Image

R Data Visualization Cookbook

Book Image

R Data Visualization Cookbook

Overview of this book

Table of Contents (17 chapters)
R Data Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Constructing a simple dendrogram


The main idea behind clustering is to detect groups of data that share some similarity. We partition the data into distinct groups that share some common traits. Clustering has been applied in fields such as biology (to study genomic data), finance (to study clustering in foreign exchange markets, stocks, different sectors/industries in an index, and so on), and economics (to study crime in various cities and international trade). We have made use of dendrograms, which are tree-like representation of clusters, as they help us to study various cluster formation with much more accuracy. The tree structure allows us to cut trees at various heights to distinguish between clusters with dissimilar characteristics.

In this recipe, we would generate 10 random numbers to introduce the concept of dendrograms. The leaves of a dendrogram merge to become a branch as we move up the tree structure. In the scatter plot on the left side, values 4 and 10 are quite similar as...