Heat Map for R

Asked 2 years ago, Updated 2 years ago, 33 views

Use the heatmap function to heat map data consisting of variables in R, Japanese language, social studies, mathematics, science, and English.The name is a letter type, and each subject is a score, so it is a numerical value.
At that time, it is clustered by name and subject, but since there are as many as 400 names, it is too detailed to see who is included in which cluster.
Can't you write the clustered results (information about who is clustered and who is clustered, not the heat map) in a text file?
Thank you for your cooperation.

r

2022-09-30 17:49

1 Answers

The function that runs inside is called hclust().

There is an explanation around here.
http://sugisugirrr.hatenablog.com/entry/2015/10/10/%E7%AC%AC%EF%BC%96%EF%BC%91%E5%9B%9E_%E3%82%AF%E3%83%A9%E3%82%B9%E3%82%BF%E3%83%BC%E5%88%86%E6%9E%90

For example,

set.seed(11)
dat<-matrix (sample(1:100, 30, replace=T), 10)

heatmap(dat)

With data like this, the cluster on the column side will be able to use

 dat_clust<-hclust(dat))
plot(dat_clust,hang=-1)

Equivalent to this

For example, a cluster with a height of 50 or less can be configured with

dat_clust$merge [dat_clust$height<50,]

How to read this result is written at the URL of ↑.


2022-09-30 17:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.