Estoy utilizando la función pheatmap en R para generar un mapa de calor. Me gustaría crear un data frame con los valores que aporta pheatmap en la escala de color.
Es decir, a partir de este hm de ejemplo
set.seed(8)
m <- matrix(rnorm(36), 6, 6)
colnames(m) <- paste("Col", 1:6)
rownames(m) <- paste("Row", 1:6)
hm <- as.data.frame(m)
pheatmap(as.matrix(hm),
scale="row",
clustering_method = "complete",
cluster_rows = F ,
cluster_cols = F, gaps_col = 3,
clustering_distance_rows = "correlation",
show_rownames = F,display_numbers = T,
cellheight = NA, cellwidth = NA,
color=colorRampPalette(c("royalblue1", "white", "firebrick2"))(100),
fontsize_row = 10, angle_col = 0, fontsize_for_colnames = 10,
filename = "hm.pdf")
dput(df)
structure(list(`Col 1` = c(-0.0845860713710238, 0.840400125597476,
-0.463482772187991, -0.550835004480379, 0.736040432105293, -0.107881401506818
), `Col 2` = c(-0.17028914982177, -1.08833171186954, -3.01105167576798,
-0.593174332801249, -0.759793796302071, 0.292049863660693), `Col 3` = c(0.421398594579087,
-1.29448908100089, 0.069285088863449, -0.813038477272046, 1.51085307235785,
-0.271608879959897), `Col 4` = c(1.55825392862137, -0.237349870104542,
1.28312288225294, -0.00948963582193302, -0.400082781659235, 0.0219856238212091
), `Col 5` = c(1.74276738119779, -1.10717415930603, -1.06048948248981,
1.95116131935762, 0.602706742607104, -2.02060948083538), `Col 6` = c(1.50667554287554,
0.963711089169582, -1.55389141221093, -0.773642378723716, 1.26077795552575,
0.428455778881058)), class = "data.frame", row.names = c("Row 1",
"Row 2", "Row 3", "Row 4", "Row 5", "Row 6"))
¿Cómo puedo extraer esosdichos valores?