0

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)  })
Maya
  • 1
  • 1
    If you are referencing a `reactive` expression, trying adding parentheses - for example, `cutree(Hmap()$tree_row, k = input$clusters)`...otherwise, you may receive more help with a complete, [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Ben Oct 08 '21 at 07:36

0 Answers0