Entering edit mode
20 months ago
mgranada3
▴
60
I have extracted normalized values from DESeq2 because I want to display only certain genes. I would now like to create a heatmap with my final matrix. This is the code I am using, but I haven't figured out how to assign the first column of my matrix to "show_rownames."
library(pheatmap)
df = read.csv("Genes.csv")
head (df)
df_num = as.matrix(df[,2:16])
pheatmap(df_num, cluster_rows=TRUE, show_rownames=TRUE, cluster_cols=FALSE)
Here are some of the codes I have tried, (1) rownames(df) = sapply(df$Gene,function(x), (2) rownames(df_num) = ("Gene"), (3) data <- read.delim(df, header=T, row.names="Gene")
Thanks in advance
Please show
head(df)
. Generally, a question is only reproducible when you show code and data examples. In R, if your column with genes wasGene
then it would beR took your code with no error but I am still not seeing row names
I added this and it worked
Above code +
Just an FYI, your code is doing the same thing as the code above. Your column is named
ï..Gene
and not justGene
which isn't super clear in your previous post. The strsplit part of yoursapply
is doing nothing because you don't have any spaces in yourï..Gene
column.