0

I have created a heatmap in R using heatmaply library which has 85 rows and 6 columns (samples). Is there ant possible way I could split my heatmap html file to indivdual sample heatmap ? I just want to view them separatly in an html file. I tried spliting the data using following code.

# Loop over each sample and create a separate plot for each one
for (sample in colnames(data)) {
  # Subset the data to only include the current sample
  sample_data <- data[, sample, drop = FALSE]
  
  # Create the plot and save as an HTML file
  p <- heatmaply(sample_data, dendrogram = "both", scale = "row",
                 colorscale = "Viridis", margins = c(80, 80),
                 main = paste0("Heatmap for ", sample))
  html_file <- paste0(sample, ".html")
  saveWidget(as.widget(p), file = html_file, selfcontained = TRUE)
}

but gives the error for hclust function. is there a wayout ?

I want to split my html file into multiple html file containing only the information of single sample each

0 Answers0