Hi everyone

I'm making heatmap by using r studio. My data have 4 rows, 1 with name and 3 with values. I export excel sheet by selecting numeric. 

    > library(readxl)
    > drug_class <- read_excel("C:/Users/hondalab/OneDrive/Desktop/16s NTR/Hiseq/drug_class.xlsx", 
    +     col_types = c("text", "numeric", "numeric", 
    +         "numeric"))
    
when i put *heatmap* command but i got this error. 

    > heatmap(drug_class)
    Error in heatmap(drug_class) : 'x' must be a numeric matrix
    
*print* command showed this;

    > print(drug_class)
    # A tibble: 29 x 4
       `drug class`                   `NTR 1 Rain` `NTR 2 Dry` `NTR 2 Rain`
       <chr>                                 <dbl>       <dbl>        <dbl>
     1 aminocoumarin                       0.00233    0.0239      0.00393  
     2 aminoglycoside                      0.00559    0.136       0.0725   
     3 antibacterial free fatty acids      0          0           0.0000264
     4 benzalkonium chloride               0          0.000615    0.000123 
     5 carbapenem                          0.00255    0.0321      0.0184   
     6 cephalosporin                       0.00444    0.0644      0.0485   
     7 cephamycin                          0.00240    0.0264      0.00830  
     8 diaminopyrimidine                   0.00244    0.0324      0.0412   
     9 fluoroquinolone                     0.00637    0.0528      0.0317   
    10 fosfomycin                          0          0           0.000412 
    # ... with 19 more rows

Can anybody help to solve this error. Thanks! 
heatmap says it requires a numeric matrix, so you probably have to convert your tibble to a matrix.

    drug_class <- as.data.frame(drug_class)
    rownames(drug_class) <- drug_class[, 1]
    drug_class[, 1] <- NULL
    drug_class <- as.matrix(drug_class)

Tidyverse ansywer

    library("tidyverse")
    
    drug class <- drug_class %>%
      column_to_rownames("drug class") %>%
      as.matrix