Text Mining with Bag-of-Words in R
Ted Kwartler
Instructor
dist_rain <- dist(rain[, 2])

# Convert to hierarchical cluster obj hc <- hclust(dist_rain)# Plot dendrogram with city labels plot(hc, labels = rain$city)

# Load dendextend package library(dendextend)# Convert distance matrix to dendrogram hc <- hclust(tweets_dist) hcd <- as.dendrogram(hc)
# Color branches hcd <- branches_attr_by_labels(hcd, c("marvin", "gaye"), "red")# Plot dendrogram with some aesthetics plot(hcd, main = "Better Dendrogram") rect.dendrogram(hcd, k = 2, border = "grey50")

Text Mining with Bag-of-Words in R