The stats package provides the hclust function to perform hierarchical clustering.
stats
hclust
Besides hclust, other methods are available, see the CRAN Package View on Clustering.