Ask Your Question
0

What is the method for including the names of my samples in a dendrogram generated using the hclust package in R?

asked 2021-11-03 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-20 22:00:00 +0000

devzero gravatar image

One method for including the names of your samples in a dendrogram generated using the hclust package in R is to use the labels parameter in the plot() function.

First, you need to generate the dendrogram using the hclust() function, saving the result to a variable (e.g. "hc"). Then, you can use the plot() function to create the dendrogram and include the labels.

For example:

# Generate dendrogram using hclust
hc <- hclust(dist(mydata))

# Plot dendrogram with labels
plot(hc, main="My Dendrogram", xlab="Samples", sub="", labels=row.names(mydata))

In this example, we are using the row names of the "mydata" matrix as the labels for the samples. You can customize the title and axis labels as desired.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-11-03 11:00:00 +0000

Seen: 10 times

Last updated: Aug 20 '21