I have a shiny dashboard script that can take a table from the user and present some plots.
one of the plots is a heatmap. I managed to show to plot itself using this code -
Hmap <- reactive({
pheatmap(as.matrix(data_input()), cluster_cols = F, cutree_rows = input$clusters)
})
renderPlot({
Hmap()
})
but when trying to extract the clusters information and adding it to the table I get this error - arguments imply differing number of rows: 4294, 0
newCol <- reactive({
cutree(Hmap$tree_row,k = input$clusters)
})
data_heatmap <- reactive({
inFile <- input$file1
dat <- read_excel(inFile$datapath)
cbind(dat, clusters=newCol) })