Trying to create pheatmap for any selected columns

Hello there,

I have a sample data consisting of a 200 rows and 18 columns.

i was trying to create a shiny app to generate pheatmap for any selected columns. using the following code i was able to generate pheatmap for any selected columns without row cluster

server <- function(input, output) {

Rimportpercent <- read_xlsx("Rimportpercent.xlsx")
Rimportpercent1<-Rimportpercent[,2:19]
data_mat<-data.matrix(Rimportpercent1)
row.names(data_mat)<-Rimportpercent$Det m/z

output$value <- renderPrint({ input$checkGroup })

output$data <-renderTable({
input$goButton
data <-isolate (data_mat[,c(NULL,input$checkGroup), drop = FALSE])

}, rownames = TRUE)

output$Displot<- renderPlot({
input$goButton
Displot <-isolate (pheatmap((data_mat[,c(NULL,input$checkGroup), drop = FALSE]), scale = "row",
cluster_rows = FALSE,
angle_col = 45,
fontsize_row =7.0,
fontsize_col =12.0,
cellwidth = 50,
cellheight =9,
width =6.0,
height = 4.0))},width = 1800, height =2000)}

But when i try to create pheatmap with both row and column cluster using the following code

server <- function(input, output) {

Rimportpercent <- read_xlsx("Rimportpercent.xlsx")
Rimportpercent1<-Rimportpercent[,2:19]
data_mat<-data.matrix(Rimportpercent1)
row.names(data_mat)<-Rimportpercent$Det m/z

output$value <- renderPrint({ input$checkGroup })

output$data <-renderTable({
input$goButton
data <-isolate (data_mat[,c(NULL,input$checkGroup), drop = FALSE])
}, rownames = TRUE)
output$Displot<- renderPlot({
input$goButton
Displot <-isolate (pheatmap((data_mat[,c(NULL,input$checkGroup), drop = FALSE]), scale = "row",
angle_col = 45,
fontsize_row =7.0,
fontsize_col =12.0,
cellwidth = 50,
cellheight =9,
width =6.0,
height = 4.0))},width = 1800, height =2000)}

i am getting an error "NA/NaN/Inf in foreign function call (arg 10)" for any selected column. but if i select all columns i am able to generate the pheatmap.
Is there any other matrix form or code that i could use to rectify this issue?
Any help is kindly appreciated.
Thank you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.