pheatmap: cannot access heatmap objects

349 Views Asked by At

I have a problem accessing the objects in the created pheatmap. please see below my code.

library(pheatmap)
set.seed(2020)
mat = matrix(rnorm(200),20,10)
rownames(mat) = paste0("g",1:20)
obj = pheatmap(mat,cluster_cols = FALSE, scale = 'row',cutree_rows = 3)

cl = cutree(obj$tree_row,3)
Error in obj$tree_row : $ operator not defined for this S4 class
> packageVersion("pheatmap")
[1] '1.0.12'

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
0

There are 0 best solutions below