inst/examples/song-words-hclust.R

# 宋词作者层次聚类谱系图
load(system.file("extdata", "SongWords.rda", package = "MSG"))
SongCorr = cor(SongWords) # 词风相关矩阵
song.hc = hclust(as.dist(1 - SongCorr))
par(mar = c(0.5, 4, .2, 0.1))
plot(song.hc, main = "", cex = .8, ylab = "高度")
rect.hclust(song.hc, k = 4, border = "red")

Try the MSG package in your browser

Any scripts or data that you put into this service are public.

MSG documentation built on July 22, 2021, 1:06 a.m.